mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-28 00:40:20 +01:00
call hook again, in case an (smtp) error happened
This commit is contained in:
parent
563673feb4
commit
ed6aaac0d9
@ -130,7 +130,7 @@ class egw_mailer extends PHPMailer
|
||||
*/
|
||||
public function SmtpSend($header, $body)
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
$mail_id = $GLOBALS['egw']->hooks->process(array(
|
||||
'location' => 'send_mail',
|
||||
'subject' => $this->Subject,
|
||||
'from' => $this->Sender ? $this->Sender : $this->From,
|
||||
@ -143,9 +143,28 @@ class egw_mailer extends PHPMailer
|
||||
|
||||
$this->addresses = array(); // reset addresses for next mail
|
||||
|
||||
try {
|
||||
// calling the overwritten method
|
||||
return parent::SmtpSend($header, $body);
|
||||
}
|
||||
catch (phpmailerException $e) {
|
||||
// in case of errors/exceptions call hook again with previous returned mail_id and error-message to log
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
'location' => 'send_mail',
|
||||
'subject' => $this->Subject,
|
||||
'from' => $this->Sender ? $this->Sender : $this->From,
|
||||
'to' => $this->addresses['To'],
|
||||
'cc' => $this->addresses['Cc'],
|
||||
'bcc' => $this->addresses['Bcc'],
|
||||
'body_sha1' => sha1($body),
|
||||
'message_id' => preg_match('/^Message-ID: (.*)$/m', $header,$matches) ? $matches[1] : null,
|
||||
'mail_id' => $mail_id,
|
||||
'error' => $e->getMessage(),
|
||||
), array(), true); // true = call all apps
|
||||
// re-throw exception
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates recipient headers.
|
||||
|
Loading…
Reference in New Issue
Block a user