From 35534549feaa1be7af1d968552a9efcd2f88cc7b Mon Sep 17 00:00:00 2001 From: Dominique FOURNIER Date: Fri, 3 Oct 2025 08:15:03 +0200 Subject: [PATCH] Smtp : il there is a connection error, reset the connection socket to not send multiple packets to closed socket (and generate associated errors) --- src/Smtp.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Smtp.php b/src/Smtp.php index 72fe45f..da70cde 100644 --- a/src/Smtp.php +++ b/src/Smtp.php @@ -106,6 +106,7 @@ class Smtp if ($errstr === "" && $php_errormsg !== "") { $errstr = $php_errormsg; } + $this->smtpStream = null; throw new \Exception(sprintf(dgettext( "domframework", "Can't connect to SMTP server : %s" @@ -139,6 +140,7 @@ class Smtp ) === false ) { + $this->smtpStream = null; throw new \Exception(sprintf(dgettext( "domframework", "Can't activate STARTTLS %s" @@ -148,6 +150,7 @@ class Smtp $this->debug("STARTTLS ACTIVATED\n"); } } elseif ($this->starttls === "encrypt") { + $this->smtpStream = null; throw new \Exception(dgettext( "domframework", "Server doesn't supports STARTTLS" @@ -170,6 +173,7 @@ class Smtp $this->putLine("AUTH LOGIN " . base64_encode($this->user) . "\r\n"); $this->putLine(base64_encode($this->password) . "\r\n"); } else { + $this->smtpStream = null; throw new \Exception( dgettext( "domframework",