From 27149b237f5cc5b5e3997316d4a51d23cf8a9f0d Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 7 Aug 2013 09:20:16 +0000 Subject: [PATCH] play around with catching the smtp error of smtp class, as it is the one that has the info about the error --- phpgwapi/inc/class.phpmailer.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index 78ca5886f3..ad4d51e5f0 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -774,8 +774,9 @@ class PHPMailer { } $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; if(!$this->smtp->Mail($smtp_from)) { + $this->SetError($this->Lang('from_failed') . $smtp_from); $this->smtp->Reset(); - throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); + throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); } // Attempt to send attach all recipients @@ -819,12 +820,14 @@ class PHPMailer { if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses $badaddresses = implode(', ', $bad_rcpt); + $this->setError($this->Lang('recipients_failed') . $badaddresses); $this->smtp->Reset(); - throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); + throw new phpmailerException($this->ErrorInfo); } if(!$this->smtp->Data($header . $body)) { + $this->setError($this->Lang('data_not_accepted')); $this->smtp->Reset(); - throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); + throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); } if($this->SMTPKeepAlive == true) { $this->smtp->Reset();