You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mailer.rst
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -215,6 +215,55 @@ As with the failover transport, round-robin retries deliveries until
215
215
a transport succeeds (or all fail). In contrast to the failover transport,
216
216
it *spreads* the load across all its transports.
217
217
218
+
Custom Transport Factories
219
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
220
+
221
+
There is a way to easily create your own custom transport factory in case you need to do something special creating the actual transport.
222
+
223
+
The new factory needs to implement `Symfony\Component\Mailer\Transport\TransportFactoryInterface`. To remove some boilerplate you can even extend from `Symfony\Component\Mailer\Transport\AbstractTransportFactory` which will simplify the new factory:
224
+
225
+
.. code-block:: php
226
+
227
+
final class CustomTransportFactory extends AbstractTransportFactory
228
+
{
229
+
public function create(Dsn $dsn): TransportInterface
230
+
{
231
+
// create and return the transport
232
+
}
233
+
234
+
protected function getSupportedSchemes(): array
235
+
{
236
+
return ['custom_schema'];
237
+
}
238
+
}
239
+
240
+
Finally, declare the new factory in setting tag the tag `mailer.transport_factory`:
0 commit comments