Skip to content

Commit 6a88663

Browse files
committed
[Mailer] Fix error message in case of an SMTP error
1 parent 5ece83c commit 6a88663

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Symfony/Component/Mailer/Transport/Smtp/EsmtpTransport.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,16 @@ private function doEhloCommand(): string
114114
{
115115
try {
116116
$response = $this->executeCommand(sprintf("EHLO %s\r\n", $this->getLocalDomain()), [250]);
117-
} catch (TransportExceptionInterface) {
118-
return parent::executeCommand(sprintf("HELO %s\r\n", $this->getLocalDomain()), [250]);
117+
} catch (TransportExceptionInterface $e) {
118+
try {
119+
return parent::executeCommand(sprintf("HELO %s\r\n", $this->getLocalDomain()), [250]);
120+
} catch (TransportExceptionInterface $ex) {
121+
if (!$ex->getCode()) {
122+
throw $e;
123+
}
124+
125+
throw $ex;
126+
}
119127
}
120128

121129
$this->capabilities = $this->parseCapabilities($response);
@@ -132,12 +140,8 @@ private function doEhloCommand(): string
132140
throw new TransportException('Unable to connect with STARTTLS.');
133141
}
134142

135-
try {
136-
$response = $this->executeCommand(sprintf("EHLO %s\r\n", $this->getLocalDomain()), [250]);
137-
$this->capabilities = $this->parseCapabilities($response);
138-
} catch (TransportExceptionInterface) {
139-
return parent::executeCommand(sprintf("HELO %s\r\n", $this->getLocalDomain()), [250]);
140-
}
143+
$response = $this->executeCommand(sprintf("EHLO %s\r\n", $this->getLocalDomain()), [250]);
144+
$this->capabilities = $this->parseCapabilities($response);
141145
}
142146

143147
if (\array_key_exists('AUTH', $this->capabilities)) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy