Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ztoa's avatar
Level 1

SMTP Server working on localhost env, not working on staging or production server.

I have configured with my localhost .env file

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 [email protected] MAIL_PASSWORD=@password MAIL_ENCRYPTION=tls

Then on my server .env is same as localhost but I can't send the mail from staging server it's raise error: Swift_TransportException Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu 534-5.7.14 2KsgmORuD_16F_etmr6PW2wXoqfw6GwTCYWnQIte1gpUPa2NOOiEfpgy7IU9LtAoB6EVN 534-5.7.14 d8Is1pl_9X5rtfKoVcF8toQVxy1LbccPIxRjaAfuplgGlPZe4_JtTHSHXk5HCDXv> 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 d22sm411602pja.14 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "534", with message "534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbv 534-5.7.14 o5Lb3kjrxl4r9_16xdJNn0B4itRb4Aj94O-uuv_DU-bhZMX3a9q1D6xysUEKyjiRKXcnd 534-5.7.14 rneiF_fDxfCMQV3sOieiiwppiU4aDyI71uMc7dFC3LufsB4HZco7FAKfi_HXWDc7> 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 d22sm411602pja.14 - 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 d22sm411602pja.14 - gsmtp ".

noete: Google Security Less secure app access is already enabled.

Thanks for help

0 likes
2 replies

Please or to participate in this conversation.