Add richer authentication support for POP3

That’s great indeed, TLS is also a requirement for Exchange Online. But still, authentication is made by basic-auth (if I understand well the following code, there is no way to choose between any other authentication mechanism like OAuth2) discourse/poll_mailbox.rb at tests-passed · discourse/discourse (

Tracing down a bit more, it seems that the Class: Net::POP3 (Ruby 2.7.0) ( library in Ruby does not support OAuth2 authentication, just basic one.

For reference:

It just expects a user and a password, rather than a user and a token, plus it would need to use the AUTH XOAUTH2 format for encoding and transmitting the token.

Sorry if I was not clear in my question, but I’m more asking about having a similar approach as per the following examples:

These approaches will allow Discourse to connect to POP3 (and hence IMAP) with OAuth2 authentication, thus fullfilling the requirements for MS and probably for GMail in the near future if not now ( OAuth 2.0 Mechanism | Gmail IMAP | Google Developers).



I think this is a very fine feature request and I very much support adding OAuth2 support to POP3.

Can’t commit though to when we can build it, but if a PR popped up we would certainly prioritize reviewing and merging it


Awesome, thank you so much! :clap:

Looking forward to seeing this feature around!


AFAICS, Google/Gmail disabled POP3 authentication other than OAuth on 30.5. Therefore, I cannot retrieve mails via POP3 any more. Would be great if Discourse would support OAuth2.

I couldn’t find any other topic besides this one. Am I the only one using Gmail with Discourse?

You can still use an App Password to authenticate with Gmail via POP3. Here is a recent relevant topic: