diff --git a/src/Mail/SmtpMailer.php b/src/Mail/SmtpMailer.php index d29fdbc6..4f9a0443 100644 --- a/src/Mail/SmtpMailer.php +++ b/src/Mail/SmtpMailer.php @@ -155,12 +155,6 @@ protected function connect(): void stream_set_timeout($this->connection, $this->timeout, 0); $this->read(); // greeting - $this->write("EHLO $this->clientHost"); - $ehloResponse = $this->read(); - if ((int) $ehloResponse !== 250) { - $this->write("HELO $this->clientHost", 250); - } - if ($this->secure === 'tls') { $this->write('STARTTLS', 220); if (!stream_socket_enable_crypto( @@ -173,6 +167,12 @@ protected function connect(): void $this->write("EHLO $this->clientHost", 250); } + $this->write("EHLO $this->clientHost"); + $ehloResponse = $this->read(); + if ((int) $ehloResponse !== 250) { + $this->write("HELO $this->clientHost", 250); + } + if ($this->username != null && $this->password != null) { $authMechanisms = []; if (preg_match('~^250[ -]AUTH (.*)$~im', $ehloResponse, $matches)) {