diff --git a/phpgwapi/inc/class.phpmailer.inc.php b/phpgwapi/inc/class.phpmailer.inc.php index f3e9728db7..78ca5886f3 100644 --- a/phpgwapi/inc/class.phpmailer.inc.php +++ b/phpgwapi/inc/class.phpmailer.inc.php @@ -774,6 +774,7 @@ class PHPMailer { } $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; if(!$this->smtp->Mail($smtp_from)) { + $this->smtp->Reset(); throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL); } @@ -818,9 +819,11 @@ class PHPMailer { if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses $badaddresses = implode(', ', $bad_rcpt); + $this->smtp->Reset(); throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); } if(!$this->smtp->Data($header . $body)) { + $this->smtp->Reset(); throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); } if($this->SMTPKeepAlive == true) { diff --git a/phpgwapi/inc/class.smtp.php b/phpgwapi/inc/class.smtp.php index 55803156f3..8cefb83e11 100644 --- a/phpgwapi/inc/class.smtp.php +++ b/phpgwapi/inc/class.smtp.php @@ -576,7 +576,6 @@ class SMTP { } if($code != 250) { - $this->Reset(); $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, @@ -672,7 +671,6 @@ class SMTP { } if($code != 250 && $code != 251) { - $this->Reset(); $this->error = array("error" => "RCPT not accepted from server", "smtp_code" => $code,