Answer the question
In order to leave comments, you need to log in
How to send mail via smtp in Laravel from different addresses?
There is a problem, to send mail in different directions, while taking the box from which to send mail from the database.
Under normal conditions, I know how mail is sent and by setting up env and config / mail, questions do not arise, but I had difficulty with dynamically changing the settings. Unfortunately, I did not find methods for setting settings on the fly in the documentation.
Please tell me, is this possible? And if so, where to look.
Answer the question
In order to leave comments, you need to log in
Actually, he asked, he answered, but maybe it will be useful to someone else
$configs = Config::get('mail.mailers.smtp');
$configs['host'] = 'smtp.yandex.ru';
config()->set('mail.mailers.smtp', $configs);
Everything is there)
https://laravel.com/docs/7.x/mail#configuring-the-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question