Skip to content

Commit bbadeae

Browse files
committed
feature #15045 [Mailer] Configuration of the message_bus to use (t-richard)
This PR was squashed before being merged into the 5.2 branch. Discussion ---------- [Mailer] Configuration of the message_bus to use <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Documents symfony/symfony#34648 Closes #12736 Commits ------- 2d924e8 [Mailer] Configuration of the message_bus to use
2 parents 95ca723 + 2d924e8 commit bbadeae

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
@@ -1174,6 +1174,52 @@ you have a transport called ``async``, you can route the message there:
11741174
Thanks to this, instead of being delivered immediately, messages will be sent to
11751175
the transport to be handled later (see :ref:`messenger-worker`).
11761176

1177+
You can configure which bus is used to dispatch the message using the ``message_bus`` option.
1178+
You can also set this to ``false`` to call the Mailer transport directly and
1179+
disable asynchronous delivery.
1180+
1181+
.. configuration-block::
1182+
1183+
.. code-block:: yaml
1184+
1185+
# config/packages/mailer.yaml
1186+
framework:
1187+
mailer:
1188+
message_bus: app.another_bus
1189+
1190+
.. code-block:: xml
1191+
1192+
<!-- config/packages/messenger.xml -->
1193+
<?xml version="1.0" encoding="UTF-8" ?>
1194+
<container xmlns="http://symfony.com/schema/dic/services"
1195+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1196+
xmlns:framework="http://symfony.com/schema/dic/symfony"
1197+
xsi:schemaLocation="http://symfony.com/schema/dic/services
1198+
https://symfony.com/schema/dic/services/services-1.0.xsd
1199+
http://symfony.com/schema/dic/symfony
1200+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1201+
1202+
<framework:config>
1203+
<framework:mailer
1204+
message_bus="app.another_bus"
1205+
>
1206+
</framework:mailer>
1207+
</framework:config>
1208+
</container>
1209+
1210+
.. code-block:: php
1211+
1212+
// config/packages/mailer.php
1213+
$container->loadFromExtension('framework', [
1214+
'mailer' => [
1215+
'message_bus' => 'app.another_bus',
1216+
],
1217+
]);
1218+
1219+
.. versionadded:: 5.1
1220+
1221+
The `message_bus` option was introduced in Symfony 5.1.
1222+
11771223
Adding Tags and Metadata to Emails
11781224
----------------------------------
11791225

0 commit comments

Comments
 (0)