Skip to content
Snippets Groups Projects
Commit 8a278943 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #2128 from ericLemanissier/patch-3


log php mail error

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents 1a990d34 1b58a07c
No related branches found
No related tags found
No related merge requests found
...@@ -513,7 +513,8 @@ class Mailer { ...@@ -513,7 +513,8 @@ class Mailer {
// Force reconnect on next ->send() // Force reconnect on next ->send()
unset($smtp_connections[$key]); unset($smtp_connections[$key]);
$alert=sprintf(__("Unable to email via SMTP:%1\$s:%2\$d [%3\$s]\n\n%4\$s\n"), $alert=_S("Unable to email via SMTP")
.sprintf(":%1\$s:%2\$d [%3\$s]\n\n%4\$s\n",
$smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage()); $smtp['host'], $smtp['port'], $smtp['username'], $result->getMessage());
$this->logError($alert); $this->logError($alert);
} }
...@@ -522,14 +523,21 @@ class Mailer { ...@@ -522,14 +523,21 @@ class Mailer {
$mail = mail::factory('mail'); $mail = mail::factory('mail');
// Ensure the To: header is properly encoded. // Ensure the To: header is properly encoded.
$to = $headers['To']; $to = $headers['To'];
return PEAR::isError($mail->send($to, $headers, $body))?false:$messageId; $result = $mail->send($to, $headers, $body);
if(!PEAR::isError($result))
return $messageId;
$alert=_S("Unable to email via php mail function")
.sprintf(":%1\$s\n\n%2\$s\n",
$to, $result->getMessage());
$this->logError($alert);
return false;
} }
function logError($error) { function logError($error) {
global $ost; global $ost;
//NOTE: Admin alert override - don't email when having email trouble! //NOTE: Admin alert override - don't email when having email trouble!
$ost->logError(__('Mailer Error'), $error, false); $ost->logError(_S('Mailer Error'), $error, false);
} }
/******* Static functions ************/ /******* Static functions ************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment