Skip to content

Commit

Permalink
add roundrobin symfony mailer transport driver
Browse files Browse the repository at this point in the history
  • Loading branch information
me-shaon committed Dec 19, 2023
1 parent b0ed9e1 commit f7d55a5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Illuminate/Mail/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\FailoverTransport;
use Symfony\Component\Mailer\Transport\RoundRobinTransport;
use Symfony\Component\Mailer\Transport\SendmailTransport;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory;
Expand Down Expand Up @@ -375,6 +376,34 @@ protected function createFailoverTransport(array $config)
return new FailoverTransport($transports);
}

/**
* Create an instance of the Symfony Roundrobin Transport driver.
*
* @param array $config
* @return \Symfony\Component\Mailer\Transport\RoundRobinTransport
*/
protected function createRoundrobinTransport(array $config)
{
$transports = [];

foreach ($config['mailers'] as $name) {
$config = $this->getConfig($name);

if (is_null($config)) {
throw new InvalidArgumentException("Mailer [{$name}] is not defined.");
}

// Now, we will check if the "driver" key exists and if it does we will set
// the transport configuration parameter in order to offer compatibility
// with any Laravel <= 6.x application style mail configuration files.
$transports[] = $this->app['config']['mail.driver']
? $this->createSymfonyTransport(array_merge($config, ['transport' => $name]))
: $this->createSymfonyTransport($config);
}

return new RoundRobinTransport($transports);
}

/**
* Create an instance of the Log Transport driver.
*
Expand Down

0 comments on commit f7d55a5

Please sign in to comment.