3
votes

I have a created an account from G Suite - [email protected]. I have enabled 2-factor authentication and created app-specific password too.

Also, I read that I need to allow less secure apps but I can't as I did 2-factor auth.

Also, my domain is working on ssl certificate from LetsEncrypt.

This is my config file:

MAIL_DRIVER=smtp
MAIL_HOST=smtp-relay.gmail.com   // or smtp.gmail.com
MAIL_PORT=465                    // or 587
[email protected]
MAIL_PASSWORD=unkdgapoymfgcwxu  << app specific password
MAIL_ENCRYPTION=ssl             // or tls
[email protected]
MAIL_FROM_NAME=Support

From admin dashboard, I ticked the 'SMTP-relay' setting:

Allowed senders: Only addresses in my domains
Only accept mail from the specified IP addresses: No
Require SMTP Authentication: Yes
Require TLS encryption: No

...and I also added 'Support' as 'Send mail as' input in Gmail Settings > Accounts

I am stuck and keep getting error:

Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials i203sm350313wmf.0 - gsmtp

I have tried all different combinations but I couldn't move any further than this error. What am I doing wrong?

I know there are many questions related this topic but I couldn't find anything working for specifically G Suite - with custom domain


I am not sure if G Suite is any different than Gmail, but when I tried with personal gmail account it works. So, if I try for my personal gmail with this config, it works:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=utrpokvkvwluwujx      < one time password
MAIL_ENCRYPTION=ssl
2
Try the MAIL_HOST to smtp.gmail.com. This is what I have in my setup and it works. Also try MAIL_ENCRYPTION=tls and your MAIL_PORT=587Felix Lebel
I've faced similar problem. Have you already solved it?Saengdaet
@JamesRiady It was long time ago :/ unfortunately I don't remember how I resolved thissenty

2 Answers

0
votes

I've faced similar problem and got it solved by disabling 2FA, then enabling access for less secure apps. You have to use your normal password afterwards.

While I'm not very happy with it securitywise, at least it's something that works.

-1
votes

This single step worked for me... No 2-step verification. As I had created a dummy account for my local development, so I was OK with this setting. Make sure you only do this if your account contains NO personal or any critical data. This is just another way of tackling this error and NOT secure.

I turned ON the setting to alow less secured apps to be allowed access. Form here : https://myaccount.google.com/lesssecureapps