N
N
Nikolay Alekseev2020-06-20 15:55:01
Laravel
Nikolay Alekseev, 2020-06-20 15:55:01

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

2 answer(s)
N
Nikolai Alekseev, 2020-06-20
@VariusRain

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);

A
Arthur Khylskyi, 2020-06-20
@ArthurPatriot

Everything is there)
https://laravel.com/docs/7.x/mail#configuring-the-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question