G
G
Garde22020-02-17 08:37:33
Laravel
Garde2, 2020-02-17 08:37:33

How to make a dynamic mail driver change?

The user must choose with the help of which service to send the mailing list. For example, there are two drivers, written in-house and Amazon SES. How can I handle this in code so that the driver changes depending on the user's choice?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
G
Garde2, 2020-03-07
@Garde2

Laravel 7.0 is out and Multiple Mail Drivers is in the box

J
JhaoDa, 2020-02-17
@JhaoDa

How to do
So, as written in https://laravel.com/docs/6.x/configuration

V
Vladimir Kokhan, 2020-02-17
@SkazochNick

By and large, the user absolutely does not care what service the mail will be sent with. I think so.

K
k2lhu, 2020-02-17
@k2lhu

I suggest you make your drivers as system components, when adding a new driver, wrap it in a wrapper class, hook all the necessary classes to the application itself, and call the one that fits in the right situation, you will find all the necessary information on the link .
In addition, it is possible to initialize components only when they are called, i.e. when the application starts, they will not be initialized, but only at the time of the call.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question