Skip to content
Snippets Groups Projects
Commit aafea545 authored by ericLemanissier's avatar ericLemanissier
Browse files

log php mail error

When the php mail function is used to send email, this change adds error logging if an error is detected by PEAR
parent 47f94560
Branches
Tags
No related merge requests found
...@@ -523,8 +523,14 @@ class Mailer { ...@@ -523,8 +523,14 @@ 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=sprintf(__("Unable to email via php mail function:%1\$s\n\n%2\$s\n"),
$to, $result->getMessage());
$this->logError($alert);
return false;
} }
function logError($error) { function logError($error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment