Skip to content

Commit 2d924e8

Browse files
t-richardOskarStark
authored andcommitted
[Mailer] Configuration of the message_bus to use
1 parent 07b139b commit 2d924e8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

mailer.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,52 @@ you have a transport called ``async``, you can route the message there:
10941094
Thanks to this, instead of being delivered immediately, messages will be sent to
10951095
the transport to be handled later (see :ref:`messenger-worker`).
10961096

1097+
You can configure which bus is used to dispatch the message using the ``message_bus`` option.
1098+
You can also set this to ``false`` to call the Mailer transport directly and
1099+
disable asynchronous delivery.
1100+
1101+
.. configuration-block::
1102+
1103+
.. code-block:: yaml
1104+
1105+
# config/packages/mailer.yaml
1106+
framework:
1107+
mailer:
1108+
message_bus: app.another_bus
1109+
1110+
.. code-block:: xml
1111+
1112+
<!-- config/packages/messenger.xml -->
1113+
<?xml version="1.0" encoding="UTF-8" ?>
1114+
<container xmlns="http://symfony.com/schema/dic/services"
1115+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1116+
xmlns:framework="http://symfony.com/schema/dic/symfony"
1117+
xsi:schemaLocation="http://symfony.com/schema/dic/services
1118+
https://symfony.com/schema/dic/services/services-1.0.xsd
1119+
http://symfony.com/schema/dic/symfony
1120+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1121+
1122+
<framework:config>
1123+
<framework:mailer
1124+
message_bus="app.another_bus"
1125+
>
1126+
</framework:mailer>
1127+
</framework:config>
1128+
</container>
1129+
1130+
.. code-block:: php
1131+
1132+
// config/packages/mailer.php
1133+
$container->loadFromExtension('framework', [
1134+
'mailer' => [
1135+
'message_bus' => 'app.another_bus',
1136+
],
1137+
]);
1138+
1139+
.. versionadded:: 5.1
1140+
1141+
The `message_bus` option was introduced in Symfony 5.1.
1142+
10971143
Adding Tags and Metadata to Emails
10981144
----------------------------------
10991145

0 commit comments

Comments
 (0)