Commit c1b35a6b authored by Fabien Potencier's avatar Fabien Potencier

bug #1244 Verify that the spool is enabled and an actual spool before flushing it (Seldaek)

This PR was merged into the 1.3 branch.

Discussion
----------

Verify that the spool is enabled and an actual spool before flushing it

Replaces #1243

Commits
-------

41c62128 Verify that the spool is enabled and an actual spool before flushing it
parents 647ccdf3 41c62128
...@@ -91,7 +91,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface ...@@ -91,7 +91,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface
$app->finish(function () use ($app) { $app->finish(function () use ($app) {
// To speed things up (by avoiding Swift Mailer initialization), flush // To speed things up (by avoiding Swift Mailer initialization), flush
// messages only if our mailer has been created (potentially used) // messages only if our mailer has been created (potentially used)
if ($app['mailer.initialized']) { if ($app['mailer.initialized'] && $app['swiftmailer.use_spool'] && $app['swiftmailer.spooltransport'] instanceof \Swift_Transport_SpoolTransport) {
$app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']); $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']);
} }
}); });
......
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