Skip to content

Commit

Permalink
Better error logging for SMTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Dec 2, 2014
1 parent 8cbd19b commit df9bcf1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion imp/lib/Compose.php
Expand Up @@ -2420,7 +2420,23 @@ public function sendRedirectMessage($to, $log = true)
try {
$injector->getInstance('IMP_Mail')->send($to, $hdr_array, $contents->getBody());
} catch (Horde_Mail_Exception $e) {
throw new IMP_Compose_Exception($e);
$e2 = new IMP_Compose_Exception($e);

if (($prev = $e->getPrevious()) &&
($prev instanceof Horde_Smtp_Exception)) {
Horde::log(
sprintf(
"SMTP Error: %s (%u; %s)",
$prev->raw_msg,
$prev->getCode(),
$prev->getEnhancedSmtpCode() ?: 'N/A'
),
'ERR'
);
$e2->logged = true;
}

throw $e2;
}

$recipients = strval($recip['list']);
Expand Down

0 comments on commit df9bcf1

Please sign in to comment.