Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9e233ec

Browse filesBrowse files
committed
Merge branch '4.4' into 5.0
* 4.4: moving mailer transport section
2 parents 4b7dd62 + 5e36315 commit 9e233ec
Copy full SHA for 9e233ec

File tree

Expand file treeCollapse file tree

1 file changed

+27
-27
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+27
-27
lines changed

‎mailer.rst

Copy file name to clipboardExpand all lines: mailer.rst
+27-27Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ and create an :class:`Symfony\\Component\\Mime\\Email` object::
119119
->subject('Time for Symfony Mailer!')
120120
->text('Sending emails is fun again!')
121121
->html('<p>See Twig integration for better HTML integration!</p>');
122-
122+
123123
$mailer->send($email);
124124

125125
// ...
@@ -644,6 +644,32 @@ and it will select the appropriate certificate depending on the ``To`` option::
644644
$firstEncryptedEmail = $encrypter->encrypt($firstEmail);
645645
$secondEncryptedEmail = $encrypter->encrypt($secondEmail);
646646

647+
Multiple Email Transports
648+
-------------------------
649+
650+
You may want to use more than one mailer transport for delivery of your messages.
651+
This can be configured by replacing the ``dsn`` configuration entry with a
652+
``transports`` entry, like:
653+
654+
.. code-block:: yaml
655+
656+
# config/packages/mailer.yaml
657+
framework:
658+
mailer:
659+
transports:
660+
main: '%env(MAILER_DSN)%'
661+
alternative: '%env(MAILER_DSN_IMPORTANT)%'
662+
663+
By default the first transport is used. The other transports can be used by
664+
adding a text header ``X-Transport`` to an email::
665+
666+
// Send using first "main" transport ...
667+
$mailer->send($email);
668+
669+
// ... or use the "alternative" one
670+
$email->getHeaders()->addTextHeader('X-Transport', 'alternative');
671+
$mailer->send($email);
672+
647673
Sending Messages Async
648674
----------------------
649675

@@ -705,32 +731,6 @@ you have a transport called ``async``, you can route the message there:
705731
Thanks to this, instead of being delivered immediately, messages will be sent to
706732
the transport to be handled later (see :ref:`messenger-worker`).
707733

708-
Multiple Email Transports
709-
-------------------------
710-
711-
You may want to use more than one mailer transport for delivery of your messages.
712-
This can be configured by replacing the ``dsn`` configuration entry with a
713-
``transports`` entry, like:
714-
715-
.. code-block:: yaml
716-
717-
# config/packages/mailer.yaml
718-
framework:
719-
mailer:
720-
transports:
721-
main: '%env(MAILER_DSN)%'
722-
important: '%env(MAILER_DSN_IMPORTANT)%'
723-
724-
By default the first transport is used. The other transports can be used by
725-
adding a text header ``X-Transport`` to an email::
726-
727-
// Send using first "main" transport ...
728-
$mailer->send($email);
729-
730-
// ... or use the "important" one
731-
$email->getHeaders()->addTextHeader('X-Transport', 'important');
732-
$mailer->send($email);
733-
734734
Development & Debugging
735735
-----------------------
736736

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.