Error Configuring Email in ERPNext with Office 365

I am trying to configure my Office 365 email account in ERPNext, but I keep receiving the following error:

**Error connecting via IMAP/POP3: b'* OK The Microsoft Exchange IMAP4 service is ready...'**

I have already:

  • Entered the email ID and App Password (generated from Microsoft 365).
  • Verified the IMAP/SMTP settings (hostnames and ports are correct).
  • Confirmed that the credentials are correct and working in other clients.

Despite this, the connection fails during setup in ERPNext.

Could you please guide me on how to resolve this?

Error

Please check your email login credentials. smtplib.SMTPAuthenticationError: (535, b’5.7.8 Username and Password not accepted. For more information, go to\n5.7.8 Can't sign in to your Google Account - Google Account Help 98e67ed59e1d1-3254aa713a4sm21040a91.27 - gsmtp’)

Hi @amitkashyaprrk:

For M365 email integration, check this:

https://discuss.frappe.io/t/tutorial-connecting-frappe-erpnext-to-microsoft-365-mail-services-oauth

… maybe you are trying to configure some Google account too?

2 Likes

Hey, @avc,

Thank you for your reply.

I’m not trying to configure a Google account. We had used a Google account earlier, but I have already deleted everything related to it. Now, I have configured Office 365, but the same error is still appearing.

Thank you for your guidance. I’ll try your suggestion and update you accordingly.