Skip to Content
Blog Post

How to send Odoo email through Microsoft 365 with OAuth, step by step

A complete walkthrough for connecting Odoo to a Microsoft 365 mailbox using OAuth instead of a password. Every menu path, every value to enter, the sender address trap, and how to test it properly.

Odoo outgoing mail server set to Outlook OAuth, connected to a Microsoft Entra app registration with SMTP.Send granted

Odoo on a hosted platform comes with a shared mail relay so that email works from day one. It is capped at a few hundred messages a day, and the cap counts recipients rather than messages, so one notification to fourteen people spends fourteen of them. Sooner or later a growing business runs out, and quotations stop arriving without anybody seeing an error.

The fix is to send through your own mailbox. This guide walks through doing that with Microsoft 365, end to end, with every menu path and every value you need to enter.

One thing to settle first. You can still connect Odoo to Microsoft 365 with a mailbox username and password, and most older guides show you that. Do not. Microsoft switches off password based SMTP by default across existing tenants at the end of December 2026, with permanent removal to follow. Anything you build on a password has months left. This guide uses OAuth, which is the supported route and does not store a credential in your database.

Allow about an hour. Half of it is in Microsoft 365 and needs an administrator there, half is in Odoo.

The three portals you will use

Keep these open in separate tabs. The settings are spread across all three and you will move between them.

Microsoft 365 admin centre     https://admin.microsoft.com
Microsoft Entra admin centre   https://entra.microsoft.com
Microsoft Defender portal      https://security.microsoft.com

The Defender portal is only needed if you take option B in step 11.

What you need to collect

By the end of part one you will have these five values. Write them down as you go. Four of them get typed into Odoo in part two.

Sending mailbox            for example notifications@example.com
Application (client) ID    a 36 character identifier
Directory (tenant) ID      a 36 character identifier
Client secret VALUE        about 40 characters, contains tildes
Odoo base URL              for example https://example.odoo.com

Treat the client secret as a password. Send it separately from the rest and not in plain email.

Before you start

Three things to decide, because changing them later is more work than getting them right now.

Which mailbox sends the mail. Use a dedicated one, not a person's. Something like notifications@, alerts@ or odoo@. It has to be a real mailbox or a shared mailbox in the tenant. A distribution list or a mail contact will not work. Whoever owns it receives bounce reports, so pick something somebody looks at occasionally.

Single tenant or multitenant app registration. Single tenant is the right default. It needs one extra setting in Odoo, covered in step 9. Skip that and sign in fails.

Where replies should go. Odoo files email replies back onto the record they came from, using a separate reply address. Changing the sender can break that without any error at all. Step 11 covers it. Read it before you change anything.

Find your Odoo base URL now

You need this exact value in step 4 and it has to match character for character. In Odoo:

Settings  >  Technical  >  System Parameters

Search the Key column for:

web.base.url

Copy the Value exactly as shown. It will look like https://example.odoo.com with no trailing slash. If you cannot see the Technical menu, switch on developer mode first at Settings, then General Settings, then scroll to the Developer Tools block at the bottom and click Activate the developer mode.

Part one: Microsoft 365

1Step 1. Enable authenticated SMTP on the mailbox

Required even though we are using OAuth. The name makes it sound like a password setting. It is not.

Go to https://admin.microsoft.com and navigate to:

Users  >  Active users  >  select the sending mailbox  >  Mail tab
    >  Manage email apps

For a shared mailbox the path is:

Teams & groups  >  Shared mailboxes  >  select it  >  Email apps

Tick the box labelled:

Authenticated SMTP

Save. The panel closes and the Email apps list now shows Authenticated SMTP as on.

Allow up to an hour for this to take effect. It is not instant, and retesting immediately gives you a failure that looks like a different problem.

2Step 2. Check the organisation level switch

The tenant wide setting overrides the per mailbox tick you just made, so both have to be right.

In the same admin centre:

Settings  >  Org settings  >  Modern authentication

Find the line that reads:

Turn off SMTP AUTH protocol for your organization

It must be UNTICKED.

Read that twice. It is phrased as a negative. Unticked means SMTP is allowed. Ticked means it is blocked. It is very easy to set the wrong way round and then spend an hour wondering why nothing works.

3Step 3. Rule out Security Defaults

Neither Security Defaults nor Conditional Access blocks OAuth, but check now so they can be eliminated later.

Go to https://entra.microsoft.com and navigate to:

Identity  >  Overview  >  Properties  >  Manage security defaults

Note whether it reads Enabled or Disabled. Write it down.

If your organisation already uses Conditional Access policies then Security Defaults is off, because the two cannot both be active.

4Step 4. Register the application

In the Entra admin centre:

Applications  >  App registrations  >  New registration

Fill the form as follows.

Name                     Odoo Mail
Supported account types  Accounts in this organizational directory only
                         (Single tenant)
Redirect URI platform    Web
Redirect URI value       /microsoft_outlook/confirm

So if your database is at https://example.odoo.com the redirect URI is exactly:

https://example.odoo.com/microsoft_outlook/confirm

No trailing slash after confirm. The path is microsoft_outlook with an underscore, not a hyphen. If your Odoo is also reached on a custom domain, add that as a second redirect URI now rather than later.

Click Register. You land on the Overview page for the new application.

5Step 5. Grant the API permissions

Read this before you start searching, because it will save you twenty minutes.

Odoo needs a permission called SMTP.Send. Almost every guide online tells you to look for it under Office 365 Exchange Online. It is not there. It is a Microsoft Graph permission. People work through the Exchange Online categories repeatedly, find nothing, and conclude something is wrong with their tenant.

For the record, the Exchange Online delegated list contains these categories and none of them holds it:

EWS, Exchange, Group, MailboxSettings, Mail, Notes, OPX, Organization,
People, PeopleSettings, Place, ReportingWebService, Tasks, User

In your new app registration:

API permissions  >  Add a permission  >  Microsoft APIs tab
    >  Microsoft Graph  >  Delegated permissions

In the search box type SMTP and tick:

SMTP.Send

Its description reads "Send emails from mailboxes using SMTP AUTH". Then clear the search, type User, and tick:

User.Read

Click Add permissions.

Now click Grant admin consent for your organisation and confirm. The two rows must both show Granted. If they show "Not granted", the connection fails later in a way that looks like a problem with the mailbox rather than with the application.

Your final permission list should read:

Microsoft Graph    SMTP.Send    Delegated    Granted
Microsoft Graph    User.Read    Delegated    Granted

Do not add Mail.Send. That is the Graph sending API, a different mechanism entirely, and it will not make SMTP work.

If SMTP.Send cannot be found or granted at all, it is not fatal. Odoo uses the Microsoft v2.0 sign in endpoint, which asks for its permissions at sign in time. Pre granting here only matters where your tenant blocks users from consenting to applications. Carry on and see what the sign in prompt does.

6Step 6. Create a client secret

In the app registration:

Certificates & secrets  >  Client secrets  >  New client secret

Description    Odoo mail server
Expires        the longest option offered, usually 24 months

Click Add.

The screen now shows a row with two columns side by side, one headed Value and one headed Secret ID. Copy the one under Value.

This trips up almost everyone. The Value is the credential. The Secret ID is an internal reference and is never used anywhere, by Odoo or by anything else. Telling them apart:

Value      about 40 characters, mixed case, contains ~ tilde characters
           shape:  Qq4W~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Secret ID  36 characters, lowercase hex in five hyphenated groups
           shape:  00000000-1111-2222-3333-444444444444

Give Odoo the Secret ID by mistake and it fails with AADSTS7000215, an invalid client secret error.

The value is displayed once. Navigate away and you cannot retrieve it, only issue a new one.

Write the expiry date somewhere that will actually be read. When the secret expires, all outgoing email from Odoo stops with no warning beforehand.

Finally go to the Overview page of the application and copy two more values:

Application (client) ID
Directory (tenant) ID

You should now have all five items from the collection list near the top.

Part two: Odoo

7Step 7. Install the connector

In Odoo:

Apps  >  clear the "Apps" filter in the search box  >  search: outlook

Install the module named Microsoft Outlook, technical name:

microsoft_outlook

It installs in seconds. No restart, no downtime, nothing else is affected.

8Step 8. Enter the application credentials

Settings  >  General Settings  >  scroll to the Discuss section

Tick:

Use Custom Email Servers

This setting only controls whether the fields are visible. It does not change how mail is sent and it is safe to tick on a live system. The Outlook fields stay hidden until it is ticked, which makes it look like the module did not install properly.

With it ticked, a block headed "Use an Outlook Server" appears below. Fill it in:

ID        your Application (client) ID
Secret    your client secret VALUE

Save.

9Step 9. Point the sign in at your tenant

Skip this only if you chose multitenant in step 4. Setting it is harmless either way, so when in doubt, set it.

Odoo defaults to Microsoft's shared sign in address, which a single tenant app registration refuses.

Settings  >  Technical  >  System Parameters  >  New

Key      microsoft_outlook.endpoint
Value    https://login.microsoftonline.com//oauth2/v2.0/

Substitute your Directory (tenant) ID. Keep the trailing slash. With a tenant ID of 11111111-2222-3333-4444-555555555555 the finished value reads:

https://login.microsoftonline.com/11111111-2222-3333-4444-555555555555/oauth2/v2.0/

Save. Miss this step and sign in fails with AADSTS50194, an error about the application not being configured as multitenant.

10Step 10. Create the outgoing mail server

Settings  >  Technical  >  Email  >  Outgoing Mail Servers  >  New

Fill it in exactly like this:

Name                 Outlook, plus your mailbox address
Priority             10
Authenticate with    Outlook OAuth Authentication
Username             your sending mailbox, in full
FROM Filtering       your sending mailbox, in full
Host                 smtp.office365.com
Port                 587
Connection Security  TLS (STARTTLS)
Active               UNTICK IT

Create it inactive. This matters more than anything else in this guide if you are working on a live system.

The moment an active outgoing mail server exists, Odoo stops using the hosted platform relay and routes everything through your new record. If that record is not finished, every email fails from that minute onward, including things customers are waiting for. There is no warning and no fallback. Leave it switched off until it has been proven.

Save the record. Leaving Active unticked means it disappears from the default list view, so note its URL or use the Archived filter to find it again.

11Step 11. Set the sender address

Here is the step that costs people the most time, because nothing about it is obvious and the error points elsewhere.

Odoo does not use the mail server's username as the From address. It builds the From address from a completely separate setting, the alias domain. If the two disagree, Microsoft rejects every message with an error saying the mailbox is not allowed to send as that address, and nothing in the mail server configuration looks wrong.

Settings  >  Technical  >  Email  >  Alias Domains  >  open the record

The form has four fields in this order:

1  Name
2  Bounce Alias
3  Catchall Alias
4  Default From Alias

Odoo composes its addresses from them like this:

From       Default From Alias @ Name
Reply-To   Catchall Alias @ Name
Return     Bounce Alias @ Name

So with Name set to example.odoo.com and Default From Alias set to the word notifications, Odoo sends as notifications@example.odoo.com. Microsoft will not let your mailbox send as that, because that domain is not in your tenant.

There are two ways to fix it, and they are not equivalent.

Option A, the safe one. Change only field 4, and put the complete email address in it.

Name                leave exactly as it is
Bounce Alias        leave as bounce
Catchall Alias      leave as catchall
Default From Alias  notifications@example.com      <- full address

That field accepts either a local part or a whole address. Given a whole address it uses it verbatim for the From header, while the reply and bounce addresses keep deriving from Name and carry on working untouched. Nothing else changes and there is nothing further to configure.

Option B. Change field 1, Name, to your company domain.

Name                example.com
Default From Alias  notifications

This also fixes the sender, but it moves the reply and bounce addresses onto your domain at the same time. Those addresses now have to exist in your tenant and forward back into Odoo, or replies to your notifications silently stop reaching the records they belong to. No error, no bounce. Somebody notices weeks later that a customer says they replied and nobody answered.

If you take option B you also need all of this:

  1. Create two shared mailboxes, catchall@ and bounce@ on your domain. Shared mailboxes, not distribution lists. Lists reject external senders by default and replies come from outside.
  2. On each, set Mail > Manage email forwarding to forward to the matching address on your Odoo platform subdomain.
  3. Allow external auto forwarding for those two mailboxes only, at https://security.microsoft.com under Policies & rules > Threat policies > Anti-spam > Create policy > Outbound, setting Automatic forwarding rules to "On - Forwarding is enabled". Microsoft blocks external forwarding tenant wide by default, so without this step a and b look correct and mail is still dropped silently. Never change the tenant default, which protects every other mailbox.

Unless you specifically want your reply address on your own domain and are willing to maintain that, take option A.

One warning while you are on this form. Name is the first field and Default From Alias is the fourth. Editing the wrong one produces addresses like catchall@notifications and breaks reply handling immediately, again with no error anywhere.

12Step 12. Connect the mailbox

Go back to the mail server record, make sure it is saved, and click:

Connect your Outlook account

If that button is not there, the client ID and secret from step 8 have not both been saved. Odoo only shows it once both are present.

You are sent to Microsoft to sign in. Sign in as the sending mailbox, not as the administrator doing the work. The token is bound to whoever signs in, and Odoo will then try to send as that person. If the browser offers an account you are already signed into, choose "Use another account" and type the mailbox address.

Accept the consent prompt. You are returned to Odoo and the record now holds a refresh token which renews itself from then on. You will not need to sign in again unless the secret expires, the mailbox password is reset in a way that revokes tokens, or an administrator withdraws the application's consent.

Multi factor authentication on the mailbox is fine. OAuth handles it. Have the authenticator to hand.

If you ever change which mailbox sends the mail, changing the username is not enough. The stored refresh token is bound to the old mailbox and has to be cleared as well, otherwise Odoo keeps using the old account and the change appears to have done nothing.

Part three: prove it works

Tick Active on the mail server record and save.

Now the important bit. Do not use the Test Connection button as your proof. It opens the SMTP conversation and stops before sending a message body, and Microsoft only checks the sender address when it sees the actual message. So the button reports success while every real email is rejected. It is useful for catching a wrong secret or a blocked port, and useless for catching the problem you are most likely to have.

Instead, work down these four.

1. Send one real email. Invite a user, email a quotation, or post a message on a record that has a follower. Then check it:

Settings  >  Technical  >  Email  >  Emails

Find your message. The Status column must read Sent. If it reads Exception, open the record and read the Failure Reason field, then see the error list below.

2. Check where it came from. Open the message in the receiving mailbox and view the message details or source. Confirm:

From        your sending mailbox
Reply-To    your catchall address

3. Reply to it. Send a normal reply from the receiving mailbox. It should appear in the chatter of the originating record within a minute. If it does not, the problem is the alias domain from step 11, not the sending setup.

4. Watch it for a day. Go back to the Emails list, filter on Exception and sort newest first. The occasional transient failure is normal. A steady stream is not.

When something goes wrong

The error messages are specific and each one tells you which step to go back to.

AADSTS7000215, invalid client secret. The Secret ID was entered instead of the Value, or the secret expired, or it was regenerated in Entra and not updated in Odoo. Step 6. Check what Odoo actually holds: a value is about forty characters with tildes, a secret ID is a hyphenated hex identifier.

AADSTS50194, application not configured as multitenant. Step 9 was skipped, or the tenant ID inside the system parameter is wrong.

AADSTS50011, redirect URI mismatch. The URI in step 4 does not match your Odoo base URL exactly. Check for a trailing slash, http against https, a hyphen where there should be an underscore, or a custom domain you did not register.

AADSTS65001, consent not granted. The Grant admin consent click in step 5 was missed or did not complete.

535 5.7.139, authentication unsuccessful. The text after the code names the gate:

"...disabled for the Tenant"           go to step 2
"...disabled for the Mailbox"          go to step 1
"...security defaults policy"          go to step 3

Remember these changes can take up to an hour to take effect, so a failure straight after a change is not conclusive.

554 5.2.252, SendAsDenied. The sender address. Step 11. The error names both addresses, the one it authenticated as and the one it tried to send as, so you can see exactly what Odoo attempted.

530 5.7.57, client not authenticated, often with 535 5.7.3 alongside. Usually a transient token refresh failure. One of these among successful sends can be ignored. A pattern means the secret has expired or consent was withdrawn.

Replies never reach Odoo and there is no error anywhere. Step 11 again, specifically the alias domain Name. If you took option B, check the Exchange message trace: if the inbound message shows as Delivered but no onward forward appears, external forwarding is being blocked and step 11c was skipped.

What you end up with

Email leaves through your own mailbox from your own domain. It inherits your existing SPF and DKIM records, so it is far less likely to be filtered as spam than mail from a shared platform relay. It is logged in your tenant alongside everything else. No password is stored in Odoo.

On volume, Exchange Online allows ten thousand recipients a day and thirty messages a minute. For operational email that is effectively no limit. The per minute figure is the one to keep in mind, because a notification addressed to fourteen people counts as fourteen, so a bulk action can trip it, and repeated errors can get the mailbox throttled for a while. Exchange is not built for mass marketing, and genuine bulk sending still belongs with a dedicated provider.

Two things to diarise. The client secret expiry from step 6, because outgoing mail stops dead on that date. And a glance at the sending mailbox now and then, because bounce reports land there rather than being read by Odoo.

If you would rather not

This is an afternoon's work when you know where the traps are, and a long day when you do not. If you want it done and verified without spending the time, we configure this for Odoo users regularly, on hosted and self hosted databases, with Microsoft 365 or Google Workspace. We will also say plainly if your current setup is fine and you do not need to change anything yet.

Want this set up and tested for you?

We configure Odoo to send through Microsoft 365 or Google Workspace with OAuth, on Odoo Online, Odoo.sh and self hosted. Fixed scope, staging first where one exists, and no password stored in your database.