@@ -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+
661691Sending 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
720750the 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-
752752Development & Debugging
753753-----------------------
754754
0 commit comments