E-mail polling on GMAIL not working

AI-generated summary

The user meetya reports issues with Gmail polling in Discourse, despite correct credentials and security settings. The problem appears related to Google’s security system flagging the connection from a New York server (DigitalOcean) as suspicious, especially since the account is based in Slovenia. meetya resolves the issue by enabling 2-Step Verification and using an App Password in Discourse, which Google interprets as a legitimate login. supermathie explains that the error indicates a security alert, not authentication failure, and that enabling 2FA satisfies Google’s requirement. meetya confirms the solution works and notes that App Passwords are the recommended approach for apps like Discourse. itsbhanusharma suggests an alternative method for incoming mail, while pfaffman recommends moving Discourse to Amsterdam for better performance and reliability.

Hello,

Since yesterday I am having difficulties polling for gmail replies as shown here:

These are my Google Account security settings:


As you can see I’ve got 2-Step Verification turned off.

I’ve also enabled Account access via this page as explained on this topic.

However, I’ve read somewhere that there might be some problems, because I am based in Slovenia, so our gmail account was created from Slovenia as well whereas our DigitalOcean servers are based in New York.

For example, when I try to log into this email account using a new browser, Gmail requires me to type in a code I receive over SMS message.

And ideas?

Note: and to state the obvious: log in credentials are correct - they were working just 5 days ago.

Thanks!
Mitja

I’m posting the solution here just in case someone else has the same problem.

What actually helped was to switch 2-step verification ON, and create an App password and insert it in the Discourse POP3 password setting instead of my usual Gmail account password

Yes - that error from gmail is not an authentication failure. It’s asking you to login from a web browser because it think something fishy is going on with the account.

By turning on 2FA you’ve done what gmail was asking - you logged in via a browser.

Are you also using it to send emails?

yeah, but before enabling 2-step verification, logging into via web-browser didn’t help either. Probably because Google cannot make the connection between discourse trying to connect (with DO servers in New York) and me connection from a browser in Slovenia.

I am using Sparkpost to send emails. I created a dedicated basic gmail account only for receiving emails (reply via email) feature.

You can maybe consider this as an alternative?

Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver

Everything is working now anyway. As far as I understood from the Gmail documentation, it is a recommended approach to give apps, such as Discourse, special App passwords, that you can generate inside your google account security settings, instead of your ‘human’ google password.

I would recommend moving discourse to Amsterdam (it is closer and the newest/best data center) and using the incoming mail server recommended above.