diff --git a/mailer.rst b/mailer.rst
index 1b3e66f2aff..710a14381d1 100644
--- a/mailer.rst
+++ b/mailer.rst
@@ -356,6 +356,54 @@ Other Options
This option was introduced in Symfony 5.2.
+Custom Transport Factories
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+There is a way to easily create your own custom transport factory in case you need to do something special creating the actual transport.
+
+The new factory needs to implement :class:`Symfony\\Component\\Mailer\\Transport\\TransportFactoryInterface`. To remove some boilerplate you can even extend from :class:`Symfony\\Component\\Mailer\\Transport\\AbstractTransportFactory` which will simplify the new factory::
+
+
+ final class CustomTransportFactory extends AbstractTransportFactory
+ {
+ public function create(Dsn $dsn): TransportInterface
+ {
+ // create and return the transport
+ }
+
+ protected function getSupportedSchemes(): array
+ {
+ return ['custom_schema'];
+ }
+ }
+
+Finally, declare the new factory in setting tag the tag `mailer.transport_factory`:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/services.yaml
+ mailer.transport_factory.custom:
+ class: App\CustomTransportFactory
+ parent: mailer.transport_factory.abstract
+ tags:
+ - {name: mailer.transport_factory}
+
+ .. code-block:: xml
+
+
+
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: