Reputation: 1760
Hey guys I am using laravel and trying to send mail from contact page. It is working fine on local server, but when I am trying to test it on server it is giving me error with user credentials error.
Here is my .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=AppPassword
MAIL_ENCRYPTION=tls
Upvotes: 2
Views: 8919
Reputation: 549
I had the same issue on my local server. I tried many options like turning on less secure apps and turned off 2-step verification but nothing seems worked for me.
So I found this solution, someone may get help with this solution.
You do not need to turn on less secure apps.
Turn on 2-step verification and then Create App Password by clicking here
Select Others (custom name) and click generate.
Use that system generated password as your gmail password.
That's It!
Upvotes: 0
Reputation: 1
Make sure that you enabled less secure app in security part of your google account. And better use
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
Upvotes: 0
Reputation: 776
Two steps: - Enable "Allow less secure apps" on your google account security policy. - Restart your local servers.
Upvotes: 1
Reputation: 434
Just change your 'driver' => 'smtp', to 'driver' => 'sendmail' in env file. Make sure allow less secure apps is ON in your google account settings.
Upvotes: 9