I have a very strange problem. I am trying to change the mail driver on runtime. I have a conditional and immediately before Mail::send() I put this line
Config::set('mail.driver','mandrill');
Mail::send() ignores my set and uses the default one. I checked the settings of Mandrill ( made that the default) and worked fine, also verified with Config::get() after the send() that its indeed set to mandrill.
@lollypopgr I'm pretty sure that the issue is caused because when laravel registers the mailer key in the IoC Container it uses the original config. Changing that won't cause laravel to re-define the mailer key.
If you take a look at MailerServiceProvider you will see that it is deferred which means that once you call it, it will instantiate the object and it uses a singleton. I believe that you've used the Mail::send() method elsewhere in the application which led to registering the mailer key in the application. Since it's a singleton it won't read your configuration files again when you re-use it.
I'm not sure it's gonna work but try to do the following:
I'm running the same issue, except I'm trying to change the mail driver in the global config (updating .env file at runtime).
With artisan tinker, I can trace the actual mail driver config, and it's the good one (mandrill). But from the website, I'm still using smtp... Very strange.
Config::set('mail.driver', 'mandrill');
(new Illuminate\Mail\MailServiceProvider(app()))->register();
P.S. I just realised that in my solution I told you to alter the mailer.driver instead of mail.driver. Try my other attempts before this post again to see maybe it actually works.