我用mandrill驱动程序配置了laravel的邮件服务.这里没问题!
现在,在我申请的某个时刻,我需要通过Gmail发送邮件.
我做了类似的事情:
// backup current mail configs
$backup = Config::get('mail');
// rewrite mail configs to gmail stmp
$new_configs = array(
'driver' => 'smtp',
// ... other configs here
);
Config::set('mail', $new_configs);
// send the email
Mail::send(...
// restore configs
Config::set('mail', $backup);
Run Code Online (Sandbox Code Playgroud)
这不起作用,laravel总是使用mandrill配置.看起来他在脚本启动时启动了邮件服务,并忽略了执行过程中的任何操作.
如何在执行期间更改邮件服务配置/行为?