Commit b5f30010 authored by Mathieu Rochette's avatar Mathieu Rochette

mailer delivery address

add supports for swiftmailer.delivery_addresses & swiftmailer.delivery_whitelist
parent 17c0eedc
...@@ -11,14 +11,11 @@ Parameters ...@@ -11,14 +11,11 @@ Parameters
---------- ----------
* **swiftmailer.use_spool**: A boolean to specify whether or not to use the * **swiftmailer.use_spool**: A boolean to specify whether or not to use the
memory spool, defaults to true. memory spool, defaults to true.
* **swiftmailer.options**: An array of options for the default SMTP-based * **swiftmailer.options**: An array of options for the default SMTP-based
configuration. 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: The following options can be set:
* **host**: SMTP hostname, defaults to 'localhost'. * **host**: SMTP hostname, defaults to 'localhost'.
...@@ -39,6 +36,17 @@ Parameters ...@@ -39,6 +36,17 @@ Parameters
'auth_mode' => null 'auth_mode' => null
); );
* **swiftmailer.sender_address**: If set, all messages will be delivered with
this address as the "return path" address.
* **swiftmailer.delivery_addresses**: If not empty, all email messages will be
sent to those addresses instead of being sent to their actual recipients. This
is often useful when developing.
* **swiftmailer.delivery_whitelist**: Used in combination with
delivery_addresses. If set, emails matching any of these patterns will be
delivered like normal, as well as being sent to delivery_addresses.
Services Services
-------- --------
......
...@@ -75,6 +75,13 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe ...@@ -75,6 +75,13 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
$transport->registerPlugin(new \Swift_Plugins_ImpersonatePlugin($app['swiftmailer.sender_address'])); $transport->registerPlugin(new \Swift_Plugins_ImpersonatePlugin($app['swiftmailer.sender_address']));
} }
if (!empty($app['swiftmailer.delivery_addresses'])) {
$transport->registerPlugin(new \Swift_Plugins_RedirectingPlugin(
$app['swiftmailer.delivery_addresses'],
$app['swiftmailer.delivery_whitelist']
));
}
return $transport; return $transport;
}; };
...@@ -95,6 +102,8 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe ...@@ -95,6 +102,8 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
}; };
$app['swiftmailer.sender_address'] = null; $app['swiftmailer.sender_address'] = null;
$app['swiftmailer.delivery_addresses'] = [];
$app['swiftmailer.delivery_whitelist'] = [];
} }
public function subscribe(Container $app, EventDispatcherInterface $dispatcher) 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