Getting a "Bad username or password" error using OpenPop.Net with Microsoft Outlook 365 email accounts

194 Views Asked by At

We have a custom application which uses OpenPop.Net, connecting via POP3 and pulling messages down for processing from a Microsoft Office 365 email account. This has always worked fine up until a couple weeks ago. We got an email that Microsoft was dropping support for POP3 with Office 365 accounts.

I'm sure we're using the correct credentials - I can log into this account via a web browser. I've seen others online who are recently getting the "Bad username or password" when trying to connect to Office 365 via POP3 as well.

I've tried setting the TLS level in our application using this line (OpenPop seems to use SSL, but it seems Office 365 requires TLS):

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

I've also tried TLS 1.1 and 1. None of theses worked.

I am hoping there is some way to get OpenPop to work with Microsoft Office 365 email accounts.

Thanks!

  • Rob
2

There are 2 best solutions below

0
Eugene Astafiev On

Microsoft has disabled basic auth protocol for POP/IMAP accounts, see Basic Authentication Deprecation in Exchange Online – September 2022 Update - Microsoft Community Hub.

0
jstedfast On

As Eugene mentioned above, Microsoft has disabled all of the standard authentication mechanisms for POP3 and IMAP accounts on Office365.

You will need to use OAuth2 instead which I don't think OpenPOP.NET supports.

You'll probably need to switch to using MailKit instead.

You can find documentation on how to authenticate via OAuth2 using MailKit here: https://github.com/jstedfast/MailKit/blob/master/ExchangeOAuth2.md