mardi 25 décembre 2018

Dynamic SMTP data in Laravel 5.6 for queued emails?

Hi I am trying to set dynamic email accounts(Logins) for laravel. I have a method called getCurrentEmailAccount() which returns the account to currently use. In my mail.php class in the config folder, I have it calling that method from there

'username' => \App\Helper\MailHelper::getCurrentEmailAccount(),
'password' => env('MAIL_PASSWORD'),

This seems to work for new items but doesn't work on already queued items. It seems like once an item has been sent to the queue, it continues to use whatever mail account was associated with it at the time of adding it to the queue and dose not get the latest. This results in login failed errors by using the old previous account that is no longer active instead of the latest one that getCurrentEmailAccount() returns.

How would I go about fixing/updating this so it will use whatever account is the latest so I don't have a bunch of failed items in my queue?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire