O
O
ObehanProger2020-01-27 13:20:40
Laravel
ObehanProger, 2020-01-27 13:20:40

Why doesn't smtp google work on the registration site?

After registering a user, when trying to send an email to confirm registration using smtp, google on the site gives an error:

Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned 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 r12sm7919415ljh.105 - gsmtp ". Authenticator PLAIN returned 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 r12sm7919415ljh.105 - gsmtp ". Authenticator XOAUTH2 returned 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 r12sm7919415ljh.105 - gsmtp

everything seems to be correct in .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Kolesnikov, 2020-01-27
@ObehanProger

Try turning on 2-Step Verification and creating a password for the app
https://support.google.com/accounts/answer/185833?hl=en

C
centum, 2020-04-03
@centum

Another solution for old customers:
Open the page https://myaccount.google.com/security ( Security)
Enable "Untrusted applications that have access to the account"

A
adam_carraway, 2020-01-27
@adam_carraway

This is most likely due to the fact that you are working on localhost, Google does not allow you to send mail from the local machine. If you just want to test, use yandex or mail.ru, or even better https://mailtrap.io/

J
Jedi, 2020-02-26
@PHPjedi

Use ssl and port 465.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question