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 :
- It is working fine in my local host
- It is also working in my server (without http)
- 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 :
- Allow less secure logged is enabled
- This same email is not used in three application for the SMTP email functionality.