I keep running into issues when trying to authenticate with Gmail’s SMTP server. The error message I get says “Please log in via your web browser and then try again” with error code 534-5.7.14.
I’m confident that my credentials are correct since I’ve double-checked the base64 encoding for both username and password. When I send the auth login command, Gmail responds asking for the password in a separate step. After I provide the encoded password, that’s when I get the browser login error.
This problem started happening specifically on MediaTemple and DreamHost servers, even though PHPMailer worked fine on other hosting providers before. I really need to get this working on these particular hosts for my current project.
Has anyone encountered this specific authentication flow issue with Gmail SMTP? What could be causing Gmail to reject the login even when credentials are properly encoded?
Had this exact problem for weeks after switching to new shared hosting. It’s usually Gmail flagging your hosting provider’s IP as suspicious, not your login method. I fixed it temporarily by enabling “Less secure app access” in Google settings, but Google’s killing that feature. The real fix is using App Passwords if you’ve got two-factor auth turned on. Just generate an app password specifically for SMTP and use that instead of your regular password. Google sees it as a trusted app rather than a sketchy login attempt, so no browser verification needed. Since this started right when you changed hosts, it’s definitely IP blocking, not bad credentials.
Same thing happened when I switched to DreamHost last month. Gmail doesn’t trust a lot of shared hosting IPs these days. First, try logging into Gmail from your server’s location - it can help build trust with their system. Also ask your host about dedicated IPs. That usually kills the 534 error since Gmail sees dedicated IPs as way less sketchy than shared ones.
Gmail’s increased security measures this past year may be the cause of your issues with certain hosts. The error code 534-5.7.14 appears when Gmail perceives some unusual activity, often related to the server’s IP reputation or location. MediaTemple and DreamHost likely use shared IPs that may have been blacklisted due to past abuses by other users. I faced similar problems when shifting from dedicated to shared hosting - my code and credentials were unchanged, yet Gmail began blocking access. Transitioning to OAuth2 instead of basic SMTP resolved my problem. Although it’s initially more complex to implement, using OAuth2 works better long-term as it avoids IP blocks by authenticating through Google’s API rather than direct login attempts via SMTP. If you have 2FA enabled, app passwords may also offer a solution, but OAuth2 is the most reliable option moving forward.