diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 205748e2..bd604301 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -1671,7 +1671,7 @@ class PHPMailer return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (Exception $exc) { - if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) { + if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) { $this->smtp->reset(); } $this->setError($exc->getMessage());