跳至内容
菜单
此问题已终结
3 回复
521 查看

Hi All,

Just to share after following the documentation to connect to Microsoft 365, I was getting errors when attempting to test the connection. https://www.odoo.com/documentation/18.0/applications/general/email_communication/azure_oauth.html


I worked out that SMTP Auth is generally disabled by default in the Microsoft 365 Tenant. You either need to enable it tenant wide, or on a per-user basis (preferred option).


There are various ways to enable this (via the GUI or script).

Below is via the GUI per user:

  1. In Microsoft Admin Center
  2. Go to Users > Active Users > Select the applicable user
  3. In the Window on the right > Choose Mail > Manage email Apps
  4. Ensure "Authenticated SMTP" is selected.
  5. Test!

Hope this saves someone unnecessary hair pulling! (and maybe it could be added to the documentation)


EDIT: I've got screenshots but as a fresh user, I'm not allowed to post the images. Sorry.

形象
丢弃
最佳答案

Thanks for the contributions here. As far as I can tell Microsoft discourages this for a reason. 


"Therefore, we highly recommend that you disable SMTP AUTH in your Exchange Online organization, and enable it only for the accounts (mailboxes) that still require it." 

Another page even mentions microsoft deprecating this option next year. 


Our client is really keen on security and as an Odoo partner it will be an uphill battle to go this route. The DNS setting was also blocked as Odoo allow sending emails from other database with the unlimited SPF record. 

Any guidance would be helpful.


https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission




形象
丢弃
最佳答案

Hi.

When connecting Odoo 18 to Microsoft 365 SMTP, the missing piece is often that SMTP Auth is disabled by default in new tenants. Even if OAuth is set up correctly, Odoo can’t send emails until authenticated SMTP is enabled.

Enable SMTP Auth (per user)

1. Go to Microsoft 365 Admin Center.

2. Navigate: Users → Active Users → select the mailbox you’ll use for Odoo.

3. In the right-hand panel, go to Mail → Manage Email Apps.

4. Enable Authenticated SMTP.

5. Save changes.

Enable SMTP Auth (tenant-wide, if needed)

1. Go to Microsoft 365 Admin Center → Settings → Org Settings → Modern Authentication.

2. Allow Authenticated SMTP at the tenant level.

Back in Odoo

Configure your outgoing mail server with:

 - SMTP Server: smtp.office365.com

 - Port: 587

 - Encryption: STARTTLS

 - Username: full email address of the user with SMTP enabled

 - Password: either the user’s password (if basic auth allowed) or app password / OAuth if configured

After enabling Authenticated SMTP, the Test Connection in Odoo should succeed, and user invitation or transactional emails will send without the “Invalid Operation” error.


Hope it helps.

形象
丢弃
编写者 最佳答案

Since this wasn't actually a question, more so an answer to an unanswered question, putting an answer here so that it looks like there is an answer :)

There are various ways to enable this (via the GUI or script).

Below is via the GUI per user:

  1. In Microsoft Admin Center
  2. Go to Users > Active Users > Select the applicable user
  3. In the Window on the right > Choose Mail > Manage email Apps
  4. Ensure "Authenticated SMTP" is selected.
  5. Test!

Hope this saves someone unnecessary hair pulling! (and maybe it could be added to the documentation)

形象
丢弃