-
Hello, Thanks for the package. I want to know If there is a good way to change mail settings in the runtime. I want to get the right settings from database and set it just before sending emails. I am using queue and the settings seems mixing. I'm stuck and looking forward to your reply. |
Beta Was this translation helpful? Give feedback.
Answered by
n1crack
Mar 23, 2023
Replies: 1 comment
-
I don't know if it is the best approach, probably not, but it worked for me. The problem was because of the mail manager is a singleton. public function send($mailer)
{
$settings = $this->mailSettings();
Config::set('mail.mailers.smtp', array_merge(Config::get('mail.mailers.smtp'), $settings->smtp));
Config::set('mail.from', $settings->from);
$config = config('mail.driver') ? config('mail') : config("mail.mailers.smtp");
$transport = app('mail.manager')->createSymfonyTransport($config);
app('mail.manager')->mailer('smtp')->setSymfonyTransport($transport);
return parent::send($mailer);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
n1crack
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know if it is the best approach, probably not, but it worked for me. The problem was because of the mail manager is a singleton.