From 40307c91dcf0589a14570317eee1094faf10caba Mon Sep 17 00:00:00 2001 From: Synchro Date: Thu, 14 Nov 2013 12:15:57 +0100 Subject: [PATCH] Delay throwing of bad recipients exception, fixes #139 --- class.phpmailer.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index 7c9b7a52..2f6831a8 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -1218,9 +1218,6 @@ class PHPMailer $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body, $this->From); } - if (count($bad_rcpt) > 0) { //Create error message for any bad addresses - throw new phpmailerException($this->lang('recipients_failed') . implode(', ', $bad_rcpt)); - } if (!$this->smtp->data($header . $body)) { throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL); } @@ -1230,6 +1227,12 @@ class PHPMailer $this->smtp->quit(); $this->smtp->close(); } + if (count($bad_rcpt) > 0) { //Create error message for any bad addresses + throw new phpmailerException( + $this->lang('recipients_failed') . implode(', ', $bad_rcpt), + self::STOP_CONTINUE + ); + } return true; }