I configured laravel's mail service with mandrill driver. No problems here!
Now, at certain point of my application, I need to send a mail via gmail.
I did something like:
// 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);
This doens't work, laravel always uses the mandrill configurations. Looks like he initiates mail service at script startup and ignores whatever you do during execution.
How do you change mail service configs/behaviour during execution?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…