Skip to content

Commit 13f969c

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: Tweaks Improve the warning about signing messages in a listener
2 parents 957c54c + 2fd9c1a commit 13f969c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mailer.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,15 @@ Before signing/encrypting messages, make sure to have:
10741074
When using OpenSSL to generate certificates, make sure to add the
10751075
``-addtrust emailProtection`` command option.
10761076

1077+
.. caution::
1078+
1079+
Signing and encrypting messages require their contents to be fully rendered.
1080+
For example, the content of :ref:`templated emails <mailer-twig>` is rendered
1081+
by a :class:`Symfony\\Component\\Mailer\\EventListener\\MessageListener`.
1082+
So, if you want to sign and/or encrypt such a message, you need to do it in
1083+
a :ref:`MessageEvent <messageevent>` listener run after it (you need to set
1084+
a negative priority to your listener).
1085+
10771086
Signing Messages
10781087
~~~~~~~~~~~~~~~~
10791088

@@ -1569,13 +1578,6 @@ also stop the event propagation)::
15691578

15701579
The ``reject()`` method was introduced in Symfony 6.3.
15711580

1572-
.. tip::
1573-
1574-
When using a ``MessageEvent`` listener to
1575-
:doc:`sign the email contents <signing-and-encrypting-messages>`, run it as
1576-
late as possible (e.g. setting a negative priority for it) so the email
1577-
contents are not set or modified after signing them.
1578-
15791581
Execute this command to find out which listeners are registered for this event
15801582
and their priorities:
15811583

0 commit comments

Comments
 (0)