Hi,
after one day of trying, I have a solution now, that I want to document here:
I use Office 365 as an Email provider in my company. In this tutorial I explain how to set it up. I assume, that you are the owner & admin of the office 365 company account.
Email Server
goto: admin.microsoft.com → Exchange
goto ‘Mail Flow’ → Connectors
Add a Connector
From: E-Mail Server of your company
To: Office 365
Add the IP of your ERP-next Server
While setting up you Domain, you will create a MX-record that looks something like:
YOURCOMAPNYNAME01i.mail.protection.outlook.com
Preparing the Email Account
Your Email Account can not be a admin in your organisation! If that is the case you have to deactivate the azure security defaults: Bereitstellen eines Standardsicherheitsniveaus in Azure Active Directory - Microsoft Entra | Microsoft Learn
Create a non-admin Email account.
Goto https://aad.portal.azure.com/ >> Users >> Multi-Factor-Authentication
Click on your user and deactivate MFA in the quicksteps.
ERPnext >> Settings >> Email Domain
Email Server: outlook.office365.com
Use IMAP: true
Use SSL: true
Port: 993
SMTP Server: YOURCOMAPNYNAME01i.mail.protection.outlook.com
Use TLS: true
Use SSL: false
Port: 25
ERPnext >> Settings >> Email Account
Email Address: foo@bar.com
Password: YourPassword
(…)
Disable SMTP server authentication: true
Let me know if that worked for you. I spend one day figuring out what to set up - hopfully this post helps you to do it quicker.
I am well aware, that you can use MFA and create an APP-Password. Feel free to contribute a tutorial if you need that.
You can set up App passwords here, after you have activated MFA.
https://account.activedirectory.windowsazure.com/AppPasswords.aspx
Cheers
Jan