From 5c1771fbd5b88b0caac5d8f8d319a1d0e50e765a Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Mon, 26 Dec 2022 22:02:41 +0100 Subject: [PATCH] [Mailer] Add a way to change the Bus transport dynamically --- mailer.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mailer.rst b/mailer.rst index 45be91a7cc4..e87e985d96d 100644 --- a/mailer.rst +++ b/mailer.rst @@ -1333,6 +1333,18 @@ disable asynchronous delivery. The :method:`Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport::stop` method was made public in Symfony 6.1. +Bus transport can also be selected by +adding an ``X-Bus-Transport`` header (which will remove automatically from +the final message):: + + // Use the bus transport "app.another_bus": + $email->getHeaders()->addTextHeader('X-Bus-Transport', 'app.another_bus'); + $mailer->send($email); + +.. versionadded:: 6.2 + + The ``X-Bus-Transport`` header support was introduced in Symfony 6.2. + Adding Tags and Metadata to Emails ----------------------------------