From fc69abab6dce6133f7e04d1552a5873c24c5e688 Mon Sep 17 00:00:00 2001 From: Jesse Norell Date: Tue, 9 Mar 2021 16:05:26 -0700 Subject: [PATCH] ispcmail: STARTTLS resets smtp connection and requires second EHLO --- interface/lib/classes/ispcmail.inc.php | 6 ++++-- server/lib/classes/ispcmail.inc.php | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php index fbf5f84dca..f5aa359577 100644 --- a/interface/lib/classes/ispcmail.inc.php +++ b/interface/lib/classes/ispcmail.inc.php @@ -612,6 +612,9 @@ class ispcmail { if (stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method) != true) { return false; } + + fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); } //AUTH LOGIN @@ -824,8 +827,7 @@ class ispcmail { else $rec_string .= $recip; } $to = $this->_encodeHeader($rec_string, $this->mail_charset); - //$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers)); - $result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers)); + $result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers), "-f $this->_mail_sender"); } // Reset the subject in case mail is resent diff --git a/server/lib/classes/ispcmail.inc.php b/server/lib/classes/ispcmail.inc.php index 2b3dc78cfc..f5aa359577 100644 --- a/server/lib/classes/ispcmail.inc.php +++ b/server/lib/classes/ispcmail.inc.php @@ -612,6 +612,9 @@ class ispcmail { if (stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method) != true) { return false; } + + fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf); + $response = fgets($this->_smtp_conn, 515); } //AUTH LOGIN -- GitLab