minor #36531 [Mailer] Don't dispatch MessageEvent twice (chalasr)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Don't dispatch MessageEvent twice

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Introduced in 829566cdea

Commits
-------

fc4be4822a [Mailer] Don't dispatch MessageEvent twice
This commit is contained in:
Robin Chalas 2020-04-22 17:47:45 +02:00
commit f2f82d1e14

View File

@ -49,11 +49,6 @@ final class Mailer implements MailerInterface
$clonedEnvelope = null !== $envelope ? clone $envelope : Envelope::create($clonedMessage);
$event = new MessageEvent($clonedMessage, $clonedEnvelope, (string) $this->transport, true);
$this->dispatcher->dispatch($event);
$message = clone $message;
$envelope = null !== $envelope ? clone $envelope : Envelope::create($message);
$event = new MessageEvent($message, $envelope, (string) $this->transport, true);
$this->dispatcher->dispatch($event);
}
$this->bus->dispatch(new SendEmailMessage($message, $envelope));