* eMail: improving Information on failed send passed on to UI

This commit is contained in:
Klaus Leithoff 2010-12-09 10:58:04 +00:00
parent bbe5a682d0
commit 0d534a2c70

View File

@ -405,7 +405,14 @@ class PHPMailer {
* @return boolean true on success, false if address already used * @return boolean true on success, false if address already used
*/ */
public function AddAddress($address, $name = '') { public function AddAddress($address, $name = '') {
try
{
return $this->AddAnAddress('to', $address, $name); 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 * @return boolean true on success, false if address already used
*/ */
public function AddCC($address, $name = '') { public function AddCC($address, $name = '') {
try
{
return $this->AddAnAddress('cc', $address, $name); 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 * @return boolean true on success, false if address already used
*/ */
public function AddBCC($address, $name = '') { public function AddBCC($address, $name = '') {
try
{
return $this->AddAnAddress('bcc', $address, $name); 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 * @return boolean
*/ */
public function AddReplyTo($address, $name = '') { public function AddReplyTo($address, $name = '') {
try
{
return $this->AddAnAddress('ReplyTo', $address, $name); 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 = '') { private function AddAnAddress($kind, $address, $name = '') {
if (!preg_match('/^(to|cc|bcc|ReplyTo)$/', $kind)) { 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; return false;
} }
$address = trim($address); $address = trim($address);
@ -2017,7 +2047,7 @@ class PHPMailer {
$msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n"; $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
} }
} }
$this->ErrorInfo = $msg; $this->ErrorInfo .= (empty($this->ErrorInfo)?'':'<br>').$msg;
} }
/** /**