Try this
> .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=<<your email address>>
MAIL_PASSWORD=<<app password>>
MAIL_ENCRYPTION=tls
Or, try this too
MAIL_PORT=465
Remember, Gmail SMTP port (TLS): 587. Gmail SMTP port (SSL): 465. Then,
> mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '<<your email>>', 'name' => '<<any name>>'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
Then, In your email config disable "two step verification"
now.. lets go to test
This problem can generally occur when you do not enable two step verification for the `gmail` account (which can be done [here][1]) you are using to send an `email`. So first, enable `two step verification`, you can find plenty of resources for enabling two step verification. After you enable it, then you have to create an `app password`. And use the `app password` in your `.env` file. When you are done with it, your `.env` file will look something like.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=<<your email address>>
MAIL_PASSWORD=<<app password>>
MAIL_ENCRYPTION=tls
and your `mail.php`
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => '<<your email>>', 'name' => '<<any name>>'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
];
After doing so, run `php artisan config:cache` and `php artisan config:clear`, then check, email should work.
[1]: https://security.google.com/settings/security/apppasswords