@@ -658,6 +658,36 @@ and it will select the appropriate certificate depending on the ``To`` option::
658
658
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
659
659
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
660
660
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
+
661
691
Sending Messages Async
662
692
----------------------
663
693
@@ -719,36 +749,6 @@ you have a transport called ``async``, you can route the message there:
719
749
Thanks to this, instead of being delivered immediately, messages will be sent to
720
750
the transport to be handled later (see :ref: `messenger-worker `).
721
751
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
-
752
752
Development & Debugging
753
753
-----------------------
754
754
0 commit comments