Skip to content

Instantly share code, notes, and snippets.

@kingpabel
Last active June 23, 2016 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingpabel/09a8d92e0a1bc3a07fb27ed0a6b5616e to your computer and use it in GitHub Desktop.
Save kingpabel/09a8d92e0a1bc3a07fb27ed0a6b5616e to your computer and use it in GitHub Desktop.
<?php
//Email configuration is set in static method,that's why when same request multiple time email configuration changed,it was not work.
//for more details http://laravel.io/forum/07-22-2014-swiftmailer-with-dynamic-mail-configuration
$app = \App::getInstance();
$app['swift.transport'] = $app->share(function ($app) {
return new TransportManager($app);
});
$mailer = new \Swift_Mailer($app['swift.transport']->driver());
\Mail::setSwiftMailer($mailer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment