configure mail laravel 5.3

1

Currently I want to configure my application in Laravel with dynamic database data for mail delivery. That is, host, port, driver, user, password I want to take them from database. How can I make the settings?

In the config/mail.php are the values that are passed to .env . Is there a way to pass a variable with the data of all the fields?

    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.gmail.com'),
    'port' => env('MAIL_PORT', 465),

I modified it to this and it still does not work as you mention

'$conf = ConfMail::find(1);

    config([
        'mail.driver' => $conf->driver,
        'mail.host' => $conf->host,
        'mail.port' => $conf-port,
        'mail.from' => [
            'mail.address' => $conf->email,
            'mail.name' => $conf->name],
        'mail.encryption' => $conf->encryption,
        'mail.username' => $conf->user,
        'mail.password' => $conf->password
    ]);

I do not know if the config lacks something.

    
asked by DeCo 03.01.2017 в 19:04
source

1 answer

2

You can modify the configuration values during the execution of the application

config([
       'mail.driver' => $driver,
       'mail.host' => $host,
       'mail.port' => $port
       ]);

link

    
answered by 03.01.2017 / 19:36
source