Created
February 17, 2016 05:22
-
-
Save oiljin/fa5dbe6f39687596b501 to your computer and use it in GitHub Desktop.
Laravel update email config on the fly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
config([ | |
'mail.host' => 'smtp.yandex.ru', | |
'mail.port' => 465, | |
'mail.encryption' =>'ssl', | |
'mail.username' => 'username', | |
'mail.password' => 'password' | |
]); | |
$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); | |
$msg = Mail::send('mail.view', ['key' => 'value'], function(Message $message) { | |
$message | |
->to('user@mail.com', 'Name') | |
->subject('Subject'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment