I get this error with stock email settings in Laravel 5.1 Homestead when I try to send a password reset mail.
Swift_TransportException in AbstractSmtpTransport.php line 162:Cannot send message without a sender address
The address is filled in app/config/mail.php:
'from' => array('address' => 'myusername@gmail.com', 'name' => 'hawle'),
The file: /bootstrap/cache/config.php
The change:
In your
.env
file you will need to set the email address and password of your email account. You also need to set the host and port of the mail server you are using.Or make sure that everything is complete in your
mail.php
file (see note below).Note: It's better to use the
.env
file, as you most likely will have a different configuration in your production environment.If everything is completed and it still doesn't work, it might be caching. You can clear the config cache with this:
Also note:
mail.php
file is located at/app/config/mail.php
(as OP said)..env
file is located at the root of your project.As Viktorminator mentioned: Take into consideration creating app passwords and not using your usual pass for this needs. Link for creating passwords myaccount.google.com/apppasswords
Make sure you have set the 'from' in app/config/mail.php
It will fix the problem.
error was still occure. after settings and run commands
check the code
If you don't have access to the .env file, you can add default values to those env calls on app/config/mail.php, like this:
This approach will try to get the data from the .env file, if there's nothing there, it'll default to whatever you set.