1
votes

I am trying to use smtp email functionality in my Laravel 6 Application.

This is my .env file code :

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

Here it is the funny part :

  1. It is working fine in my local host
  2. It is also working in my server (without http)
  3. It stopped working when I applied https in my server.

It gives me below error :

Failed to authenticate on SMTP server with username "*********@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.14 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 g6sm37628450pja.2 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.14 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 g6sm37628450pja.2 - 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 g6sm37628450pja.2 - gsmtp ".

Note :

  1. Allow less secure logged is enabled
  2. This same email is not used in three application for the SMTP email functionality.
2
@DaImTo : this is the standard process of sending emails using SMTP in Laravel i am following. It is working fine in my localhost, server (http) but not working in https.aliasgar vanak

2 Answers

1
votes

the email is working in localhost, the less secure account account verification is correct

But you can't use your email in more than 3 projects, so you should stop using this email on other accounts.

-1
votes

Check if your gmail password has the $ character, if so change it. it worked for me