Laravel, Failed to Authenticate on Smtp Server With Username "" Using 3 Possible Authenticators

Failed to authenticate on SMTP server error using gmail

This will not work as of May 30, 2022 checkout here https://support.google.com/accounts/answer/6010255?hl=en&authuser=6 Thanks @sarout for pointing this out.

Did you turn on the "Allow less secure apps" on? go to this link

https://myaccount.google.com/security#connectedapps

Take a look at the Sign-in & security -> Apps with account access menu.

You must turn the option "Allow less secure apps" ON.

If is still doesn't work try one of these:

  • Go to https://accounts.google.com/UnlockCaptcha , and click continue
    and unlock your account for access through other media/sites.

  • Use double quote in your password: "your password"

And change your .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=dianexxxxx@gmail.com
MAIL_PASSWORD=xxxxxx
MAIL_ENCRYPTION=tls

because the one's you have specified in the mail.php will only be used if the value is not available in the .env file.

Laravel - Failed to authenticate on SMTP server with username

I have the same your problem today. For months the smtp has been working well and suddently today it gives me the same your error.

For what it worth I simply solved, re-generating the password in google Account -> Security -> App passwords.

It's not the first time this happend to me. Maybe it's some sort of Google protection... but I didn't found evidence of that anywhere. Anyway it's very annoying.

What I wonder is how to catch this kind of error so that we can intervene on time.

Expected response code 250 but got code 535, with message 535-5.7.8 Username and Password not accepted

I researched on the internet and some answers includes enabling the "access for lesser app" and "unlocking gmail captcha" which sadly didn't work for me until I found the 2-step verification.

What I did the following was:

  1. enable the 2-step verification to google HERE

  2. Create App Password to be use by your system HERE

  3. I selected Others (custom name) and clicked generate

  4. Went to my env file in laravel and edited this

    MAIL_USERNAME=talentscoutphil@gmail.com

    MAIL_PASSWORD=thepasswordgenerated

  5. Restarted my apache server and boom! It works again.

This was my solution. I created this to atleast make other people not go wasting their time researching for a possible answer.



Related Topics



Leave a reply



Submit