Commit 1088faf2 authored by Fabien Potencier's avatar Fabien Potencier

feature #1346 mailer delivery address (mathroc)

This PR was merged into the 2.0.x-dev branch.

Discussion
----------

mailer delivery address

add supports for swiftmailer.delivery_addresses & swiftmailer.delivery_whitelist

Commits
-------

b5f30010 mailer delivery address
parents 17c0eedc b5f30010
......@@ -11,14 +11,11 @@ Parameters
----------
* **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
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'.
......@@ -39,6 +36,17 @@ Parameters
'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
--------
......
......@@ -75,6 +75,13 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
$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;
};
......@@ -95,6 +102,8 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
};
$app['swiftmailer.sender_address'] = null;
$app['swiftmailer.delivery_addresses'] = [];
$app['swiftmailer.delivery_whitelist'] = [];
}
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