From 0d534a2c70ac392355323dc285af330b9b8bf1a2 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 9 Dec 2010 10:58:04 +0000 Subject: [PATCH] * eMail: improving Information on failed send passed on to UI --- phpgwapi/inc/class.phpmailer.inc.php | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index d05d2eda0c..1424fddcec 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -405,7 +405,14 @@ class PHPMailer { * @return boolean true on success, false if address already used */ public function AddAddress($address, $name = '') { - return $this->AddAnAddress('to', $address, $name); + try + { + return $this->AddAnAddress('to', $address, $name); + } catch (phpmailerException $e) + { + //$this->SetError(__METHOD__.__LINE__.$e->getMessage()); + return false; + } } /** @@ -416,7 +423,15 @@ class PHPMailer { * @return boolean true on success, false if address already used */ public function AddCC($address, $name = '') { - return $this->AddAnAddress('cc', $address, $name); + try + { + return $this->AddAnAddress('cc', $address, $name); + } catch (phpmailerException $e) + { + //$this->SetError(__METHOD__.__LINE__.$e->getMessage()); + return false; + } + } /** @@ -427,7 +442,14 @@ class PHPMailer { * @return boolean true on success, false if address already used */ public function AddBCC($address, $name = '') { - return $this->AddAnAddress('bcc', $address, $name); + try + { + return $this->AddAnAddress('bcc', $address, $name); + } catch (phpmailerException $e) + { + //$this->SetError(__METHOD__.__LINE__.$e->getMessage()); + return false; + } } /** @@ -437,7 +459,14 @@ class PHPMailer { * @return boolean */ public function AddReplyTo($address, $name = '') { - return $this->AddAnAddress('ReplyTo', $address, $name); + try + { + return $this->AddAnAddress('ReplyTo', $address, $name); + } catch (phpmailerException $e) + { + //$this->SetError(__METHOD__.__LINE__.$e->getMessage()); + return false; + } } /** @@ -451,7 +480,8 @@ class PHPMailer { */ private function AddAnAddress($kind, $address, $name = '') { if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { - echo 'Invalid recipient array: ' . kind; + $this->SetError('Invalid recipient type: ' . $kind. ' for Address:'.$address.' '.$name); + echo 'Invalid recipient array: ' . $kind; return false; } $address = trim($address); @@ -2017,7 +2047,7 @@ class PHPMailer { $msg .= '

' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "

\n"; } } - $this->ErrorInfo = $msg; + $this->ErrorInfo .= (empty($this->ErrorInfo)?'':'
').$msg; } /**