bug #30787 [Mailer] Fix SMTP support when a message cannot be sent (fabpot)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Mailer] Fix SMTP support when a message cannot be sent

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

3d25c1c613 [Mailer] fixed SMTP support when a message cannot be sent
This commit is contained in:
Fabien Potencier 2019-03-30 16:52:03 +01:00
commit c128d50196

View File

@ -111,7 +111,13 @@ class SmtpTransport extends AbstractTransport
$this->start();
}
$message = parent::send($message, $envelope);
try {
$message = parent::send($message, $envelope);
} catch (TransportExceptionInterface $e) {
$this->executeCommand("RSET\r\n", [250]);
throw $e;
}
$this->checkRestartThreshold();