Commit cbe94829 authored by Fabien Potencier's avatar Fabien Potencier

added sender_address to switfmailer provider

parent ebe7e78f
......@@ -12,9 +12,13 @@ Parameters
* **swiftmailer.use_spool**: A boolean to specify whether or not to use the
memory spool, defaults to true.
* **swiftmailer.options**: An array of options for the default SMTP-based
configuration.
* **swiftmailer.sender_address**: If set, all messages will be delivered with
this address as the "return path" address.
The following options can be set:
* **host**: SMTP hostname, defaults to 'localhost'.
......
......@@ -71,6 +71,10 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
$transport->setPassword($options['password']);
$transport->setAuthMode($options['auth_mode']);
if (null !== $app['swiftmailer.sender_address']) {
$transport->registerPlugin(new \Swift_Plugins_ImpersonatePlugin($app['swiftmailer.sender_address']));
}
return $transport;
};
......@@ -89,6 +93,8 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
$app['swiftmailer.transport.eventdispatcher'] = function () {
return new \Swift_Events_SimpleEventDispatcher();
};
$app['swiftmailer.sender_address'] = null;
}
public function subscribe(Container $app, EventDispatcherInterface $dispatcher)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment