From e5ed992c30047091f8b2959b995f6522bb48027b Mon Sep 17 00:00:00 2001 From: "alirezasedghi911@gmail.com" Date: Tue, 4 Feb 2020 15:15:50 +0330 Subject: [PATCH] Add support of the additional SMTP driver options --- src/TransportManager.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/TransportManager.php b/src/TransportManager.php index 3082a2d..52e2c83 100644 --- a/src/TransportManager.php +++ b/src/TransportManager.php @@ -23,6 +23,30 @@ public static function createSmtpDriver($config) $transport->setUsername($setting['username'] ?? $config->getEmail()); $transport->setPassword($setting['pass']); + return self::configureSmtpDriver($transport, $provider); + } + + /** + * Configure the additional SMTP driver options. + * + * @param \Swift_SmtpTransport $transport + * @param array $config + * @return \Swift_SmtpTransport + */ + protected static function configureSmtpDriver($transport, $config) + { + if (isset($config['stream'])) { + $transport->setStreamOptions($config['stream']); + } + + if (isset($config['source_ip'])) { + $transport->setSourceIp($config['source_ip']); + } + + if (isset($config['local_domain'])) { + $transport->setLocalDomain($config['local_domain']); + } + return $transport; }