Im trying to Mail in Laravel 5.1
my mail.php code is
return [
\'driver\' => env(\'MAIL_DRIVER\', \'smtp\'),
\'host\' => env(\'MAIL_HOS
you need to enable your 2 step verification from gmail account.
https://myaccount.google.com/security
then use the generated key from there to your ENV_PASSWORD instead your real password.
I had the same problem. I changed,
MAIL_ENCRYPTION=null to
MAIL_ENCRYPTION=tls
php artisan config:cache
and it worked.
After enabling logging to the mail from the less secured devices, make sure that .env
file contains the following configurations:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your_email@gmail.com
MAIL_PASSWORD="your_passwrod_here"
MAIL_ENCRYPTION=tls
Make sure that your password is rounded by the double quotes ""
.
Make sure that your mail.php
file contains configurations like the following:
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'your_email@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'your_email'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
And don't forget to close the server and run php artisan config:clear
to clear the configuration cache.
This worked for me
Change in .env
file:
MAIL_ENCRYPTION=tls
Clear cache:
php artisan config:cache
For Gmail accounts you need also turn on "Less secure app access" on https://myaccount.google.com/security. However that option shouldn't be changed on main account.
Use SSL
and port 465
like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=mail@gmail.com
MAIL_PASSWORD=12345678
MAIL_ENCRYPTION=ssl
100% will work.
You should restart the artisan after those changes. That was the issue for me.