mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-05 12:59:47 +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)
|
public function SmtpSend($header, $body)
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->hooks->process(array(
|
$mail_id = $GLOBALS['egw']->hooks->process(array(
|
||||||
'location' => 'send_mail',
|
'location' => 'send_mail',
|
||||||
'subject' => $this->Subject,
|
'subject' => $this->Subject,
|
||||||
'from' => $this->Sender ? $this->Sender : $this->From,
|
'from' => $this->Sender ? $this->Sender : $this->From,
|
||||||
@ -143,8 +143,27 @@ class egw_mailer extends PHPMailer
|
|||||||
|
|
||||||
$this->addresses = array(); // reset addresses for next mail
|
$this->addresses = array(); // reset addresses for next mail
|
||||||
|
|
||||||
// calling the overwritten method
|
try {
|
||||||
return parent::SmtpSend($header, $body);
|
// 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user