Laravel 5.5 - Sending E-mail / Archive Env

0

I'm migrating a site I have for Laravel 5 and I came across a problem.

To send email in Laravel I need to manually populate the user and host port data in the .env file

As on my site I have an interface for the user to interact with, I end up receiving this encrypted data from the database, so it becomes unfeasible to fill the MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD data manually in the .ENV file, so I ask:

Is it possible to pass this on to the ENV file or to access a function in which I can directly pass this data and trigger the email?

    
asked by anonymous 24.02.2018 / 19:40

1 answer

0

I solved my problem as follows:

Lavavel has a form of access in which you can set properties directly at runtime using config .

As I wanted to populate the email settings, I needed to access the properties responsible for the email that is in Config \ Mail.php.

Through the above item I was able to identify the name of each property to set the values there:

    config(['mail.host' => 'smtp.meusite.com.br']);
    config(['mail.port' => '587']);
    config(['mail.username' => '[email protected]']);
    config(['mail.password' => 'senha']);

Below the documentation link for anyone who needs it!

link

    
27.02.2018 / 00:25