diff --git a/components/mailer.rst b/components/mailer.rst index 36caa78c972..c81dd059f53 100644 --- a/components/mailer.rst +++ b/components/mailer.rst @@ -100,24 +100,37 @@ binary. For third-party providers, refers to the following table: Sendgrid smtp://apikey:KEY@sendgrid n/a api://KEY@sendgrid ==================== ================================== ================================== ================================ -Failover Transport ------------------- +Load Balancing +-------------- -You can create failover transport with the help of `||` operator:: +Symfony's mailer supports `load balancing`_ so you can distribute the mailing +workload across multiple transports. There are two main techniques to balance +the load: failover and round-robin. + +Failover Load Balancing +~~~~~~~~~~~~~~~~~~~~~~~ + +A failover transport is configured with two or more transports joined by the +``||`` operator:: $dsn = 'api://id@postmark || smtp://key@sendgrid'; -So if the first transport fails, the mailer will attempt to send through the -second transport. +The mailer will start using the first transport. If the sending fails, the +mailer won't retry it with the other transports, but it will switch to the next +transport automatically for the following deliveries. -Round Robin ------------ +Round-Robin Load Balancing +~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you want to send emails by using multiple transports in a round-robin fashion, -you can use the ``&&`` operator between the transports:: +A round-robin transport is configured with two or more transports joined by the +``&&`` operator:: $dsn = 'api://id@postmark && smtp://key@sendgrid' +The mailer will start using the first transport and if it fails, it will retry +the same delivery with the next transports until one of them succeeds (or until +all of them fail). + Sending emails asynchronously ----------------------------- @@ -167,3 +180,5 @@ Learn More To learn more about how to use the mailer component, refer to the :doc:`Symfony Framework Mailer documentation `. + +.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)