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
No related branches found
No related tags found
No related merge requests found
......@@ -523,8 +523,14 @@ class Mailer {
$mail = mail::factory('mail');
// Ensure the To: header is properly encoded.
$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) {
......
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