File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
src/Symfony/Component/Mailer Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,11 @@ public function send(RawMessage $message, Envelope $envelope = null): void
48
48
}
49
49
50
50
if (null !== $ this ->dispatcher ) {
51
+ // The dispatched event here has `queued` set to `true`; the goal is NOT to render the message, but to let
52
+ // listeners do something before a message is sent to the queue.
53
+ // We are using a cloned message as we still want to dispatch the **original** message, not the one modified by listeners.
54
+ // That's because the listeners will run again when the email is sent via Messenger by the transport (see `AbstractTransport`).
55
+ // Listeners should act depending on the `$queued` argument of the `MessageEvent` instance.
51
56
$ clonedMessage = clone $ message ;
52
57
$ clonedEnvelope = null !== $ envelope ? clone $ envelope : Envelope::create ($ clonedMessage );
53
58
$ event = new MessageEvent ($ clonedMessage , $ clonedEnvelope , (string ) $ this ->transport , true );
You can’t perform that action at this time.
0 commit comments