Laravel sending Email with gmail - after less secure app option (no longer support) June 2022

Viewed 1121

Few days ago gmail change is policy regarding the option "Less secure apps & your Google Account" This setting is no longer available

My Laravel app is stopped sending email

MAIL_MAILER=smtp
#MAIL_HOST=smtp.gmail.com
#MAIL_PORT=465
#MAIL_USERNAME=test@gmail.com
#MAIL_PASSWORD= *********
#MAIL_ENCRYPTION= ssl
#MAIL_FROM_ADDRESS=test@gmail.com
#MAIL_FROM_NAME=""`

Please help

2 Answers

yes, It's not working after removing the option by google. But nothing to worry! It's still very simple to send email. To send email again you need to do this as bellow:

  1. Login to your gmail account e.g. myaccount.google.com afaik
  2. Go to Security setting and Enable 2 factor (step) authentication
  3. After enabling this you can see app passwords option. Click here!
  4. And then, from Your app passwords tab select Other option and put your app name and click GENERATE button to get new app password.
  5. Finally copy the 16 digit of password and click done. Now use this password instead of email password to send mail via your app.

Now you can use just email and this generated pass to send email.

from https://stackoverflow.com/a/72626684/533426

Hi dear adnan first of all please change the MAIL_USERNAME=test@gmail.com to real Gmail account. And make your that email you are using not have setup 2 step authentication or any security.....

And the second please remove bactick from MAIL_FROM_NAME=""`

After all don't forget to clear cache

Run: php artisan optimize:clear

Related