Skip to content

Commit 5e36315

Browse files
committed
minor symfony#13495 Moving mailer transport section (weaverryan)
This PR was merged into the 4.4 branch. Discussion ---------- Moving mailer transport section See symfony/symfony#36348 (comment) I moved this Mailer "transport" section above Messenger so that, if you're reading the Messenger section, you can't accidentally keep reading and think that the "mailer transports" section is talking about Messenger transports. Also, I changed the transport name from `important` to `alternative` just to add some further differentiation. Commits ------- 8700f2e moving mailer transport section
2 parents 3f53240 + 8700f2e commit 5e36315

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

mailer.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,36 @@ and it will select the appropriate certificate depending on the ``To`` option::
658658
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
659659
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
660660

661+
Multiple Email Transports
662+
-------------------------
663+
664+
.. versionadded:: 4.4
665+
666+
The option to define multiple email transports was introduced in Symfony 4.4.
667+
668+
You may want to use more than one mailer transport for delivery of your messages.
669+
This can be configured by replacing the ``dsn`` configuration entry with a
670+
``transports`` entry, like:
671+
672+
.. code-block:: yaml
673+
674+
# config/packages/mailer.yaml
675+
framework:
676+
mailer:
677+
transports:
678+
main: '%env(MAILER_DSN)%'
679+
alternative: '%env(MAILER_DSN_IMPORTANT)%'
680+
681+
By default the first transport is used. The other transports can be used by
682+
adding a text header ``X-Transport`` to an email::
683+
684+
// Send using first "main" transport ...
685+
$mailer->send($email);
686+
687+
// ... or use the "alternative" one
688+
$email->getHeaders()->addTextHeader('X-Transport', 'alternative');
689+
$mailer->send($email);
690+
661691
Sending Messages Async
662692
----------------------
663693

@@ -719,36 +749,6 @@ you have a transport called ``async``, you can route the message there:
719749
Thanks to this, instead of being delivered immediately, messages will be sent to
720750
the transport to be handled later (see :ref:`messenger-worker`).
721751

722-
Multiple Email Transports
723-
-------------------------
724-
725-
.. versionadded:: 4.4
726-
727-
The option to define multiple email transports was introduced in Symfony 4.4.
728-
729-
You may want to use more than one mailer transport for delivery of your messages.
730-
This can be configured by replacing the ``dsn`` configuration entry with a
731-
``transports`` entry, like:
732-
733-
.. code-block:: yaml
734-
735-
# config/packages/mailer.yaml
736-
framework:
737-
mailer:
738-
transports:
739-
main: '%env(MAILER_DSN)%'
740-
important: '%env(MAILER_DSN_IMPORTANT)%'
741-
742-
By default the first transport is used. The other transports can be used by
743-
adding a text header ``X-Transport`` to an email::
744-
745-
// Send using first "main" transport ...
746-
$mailer->send($email);
747-
748-
// ... or use the "important" one
749-
$email->getHeaders()->addTextHeader('X-Transport', 'important');
750-
$mailer->send($email);
751-
752752
Development & Debugging
753753
-----------------------
754754

0 commit comments

Comments
 (0)