lundi 16 janvier 2017

Updating config on runtime for a user

I am using Laravel 5.1

I created a function to get smtp info from db for a user $mail_config=STMPDetails::where('user_id',36)->first() and then I can just call config helper function and pass the array to set config value config($mail_config). and then I call Mail::queue function.

but before it reaches createSmtpDriver@vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php where it reads the configuration again to send the mail, mail config are changed to the one specified in .env file.

Another thing to note is Mail sending function is in a Listener

I am not able to figure out where can I call the function such that configuration changes are retained before mail is sent.

Thanks, K



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire