Skip to content

Commit 2fd9c1a

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Tweaks Improve the warning about signing messages in a listener
2 parents 3da476f + d22a4bd commit 2fd9c1a

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
@@ -1034,6 +1034,15 @@ Before signing/encrypting messages, make sure to have:
10341034
When using OpenSSL to generate certificates, make sure to add the
10351035
``-addtrust emailProtection`` command option.
10361036

1037+
.. caution::
1038+
1039+
Signing and encrypting messages require their contents to be fully rendered.
1040+
For example, the content of :ref:`templated emails <mailer-twig>` is rendered
1041+
by a :class:`Symfony\\Component\\Mailer\\EventListener\\MessageListener`.
1042+
So, if you want to sign and/or encrypt such a message, you need to do it in
1043+
a :ref:`MessageEvent <messageevent>` listener run after it (you need to set
1044+
a negative priority to your listener).
1045+
10371046
Signing Messages
10381047
~~~~~~~~~~~~~~~~
10391048

@@ -1515,13 +1524,6 @@ the email is sent::
15151524

15161525
Methods ``addStamp()`` and ``getStamps()`` were introduced in Symfony 6.2.
15171526

1518-
.. tip::
1519-
1520-
When using a ``MessageEvent`` listener to
1521-
:doc:`sign the email contents <signing-and-encrypting-messages>`, run it as
1522-
late as possible (e.g. setting a negative priority for it) so the email
1523-
contents are not set or modified after signing them.
1524-
15251527
Execute this command to find out which listeners are registered for this event
15261528
and their priorities:
15271529

0 commit comments

Comments
 (0)