I am trying to send an email in laravel application.
Here is my .env
file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME
Well, I got it. Infact the email was not authenticated because that email required a mobile phone authentication after login. changing to other email address that required just login credentials, it worked.
.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=youremail@host.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
If the above comments do not work, try clearing the cache:
php artisan cache:clear
php artisan config:clear
maybe port error , you can look this web laravel or lumen send email
I made the following mistake: I did not actually include the
'encryption' => env('MAIL_ENCRYPTION'),
to the array return in mail.php. I did include my host, port, username and password in the mail.php but not the encryption method (the encryption method I only included in the .env file), so trying out these mentioned solutions did bring a change in the error messages outcome, created a bigger confusion, but none solved the problem. Hope this helps someone!
GMail SMTP requires encryption. Try changing setting as following.
MAIL_PORT=465
MAIL_ENCRYPTION=ssl