Commit 41c62128 authored by Jordi Boggiano's avatar Jordi Boggiano

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

parent 647ccdf3
......@@ -91,7 +91,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface
$app->finish(function () use ($app) {
// To speed things up (by avoiding Swift Mailer initialization), flush
// 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']);
}
});
......
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