From e030125946f2451ef63851dbd394d0811a447085 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 25 Aug 2011 14:04:12 +0000 Subject: catch failed mail deliveries --- it_mail.class | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/it_mail.class b/it_mail.class index 33105a3..81a282f 100644 --- a/it_mail.class +++ b/it_mail.class @@ -179,7 +179,7 @@ function add_file($filename, $mimetype = "application/octet-stream", $name = '') /** * Send this email message - * @return True if mail was sent + * @return True if mail was accepted for delivery */ function send() { @@ -287,7 +287,11 @@ function send() } if (it::is_live() || EDC('forcemail')) - return mail($to, $this->header_escape($this->subject), $text, join("\n", $headers), $this->flags); + { + if (($result = mail($to, $this->header_escape($this->subject), $text, join("\n", $headers), $this->flags)) === false) + it::error(array('title' => 'failed sending mail', 'body' => D($to, $this->header_escape($this->subject), $text, $headers, $this->flags))); + return $result; + } else return ED($to, $this->header_escape($this->subject), $text, $headers, $this->flags); } -- cgit v1.2.3