Skip to content

Commit 52cb0ea

Browse files
committed
[Mailer] fixed error that is masked by another error
1 parent 764fa25 commit 52cb0ea

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Smtp/SmtpTransport.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ public function send(RawMessage $message, SmtpEnvelope $envelope = null): ?SentM
114114
try {
115115
$message = parent::send($message, $envelope);
116116
} catch (TransportExceptionInterface $e) {
117-
$this->executeCommand("RSET\r\n", [250]);
117+
try {
118+
$this->executeCommand("RSET\r\n", [250]);
119+
} catch (TransportExceptionInterface $_) {
120+
// ignore this exception as it probably means that the server error was final
121+
}
118122

119123
throw $e;
120124
}

SmtpTransport.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ public function send(RawMessage $message, SmtpEnvelope $envelope = null): ?SentM
114114
try {
115115
$message = parent::send($message, $envelope);
116116
} catch (TransportExceptionInterface $e) {
117-
$this->executeCommand("RSET\r\n", [250]);
117+
try {
118+
$this->executeCommand("RSET\r\n", [250]);
119+
} catch (TransportExceptionInterface $_) {
120+
// ignore this exception as it probably means that the server error was final
121+
}
118122

119123
throw $e;
120124
}

Transport/Smtp/SmtpTransport.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ public function send(RawMessage $message, SmtpEnvelope $envelope = null): ?SentM
114114
try {
115115
$message = parent::send($message, $envelope);
116116
} catch (TransportExceptionInterface $e) {
117-
$this->executeCommand("RSET\r\n", [250]);
117+
try {
118+
$this->executeCommand("RSET\r\n", [250]);
119+
} catch (TransportExceptionInterface $_) {
120+
// ignore this exception as it probably means that the server error was final
121+
}
118122

119123
throw $e;
120124
}

0 commit comments

Comments
 (0)