4

I want to use my G Suit account to send email. I have already enabled 2FA and create app password just like in this answer. Here is my config:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=my-gsuite@example.com
MAIL_PASSWORD=16charactersAppPassword
MAIL_ENCRYPTION=tls

When I try to send email, I get this error:

Failed to authenticate on SMTP server with username "my-gsuite@example.com" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response   
  code 235 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 d188sm5389721pfa.7 - gsmtp  

Also I did clear the cache

php artisan config:cache

It worked if I change to use normal Gmail account. Anyone have any idea?

Dũng Nguyễn
  • 485
  • 1
  • 4
  • 20

1 Answers1

1

I think you need to ask your administrator to enable the less secure app option on their admin dashboard. You probably will received an email from google indicate that you need to turn on your less secure app access.

Quek Yao Jing
  • 174
  • 1
  • 9