Resolve Outgoing Email in Odoo 12-18 with Microsoft Outlook UPN (Authentication Issue)
- John Julius Danker Khoo
- 10 hours ago
- 1 min read
Integrating Odoo 12 with Microsoft Outlook for outgoing mail can present authentication issues when the User Principal Name (UPN) differs from the email address. This enhancement solves the issue by introducing UPN-based authentication in the microsoft_outlook module.

Problem Overview
In some Microsoft configurations:
Email address is used for sending/receiving.
UPN is used for authentication.
Example Case (Problematic)
Without UPN support, Odoo uses the email for authentication, resulting in failure.
Solution
Introduce a dedicated UPN field to use specifically for Microsoft OAuth token generation, while retaining the email for mail delivery.
Steps
Update outlook scope url, create a custom field outlook_upn

use outlook upn for generating oauth, update token value whether fail or success

Ensure Url is HTTPS, add tenant id information as endpoint

Lastly, ensure server running is https as per requirement by Microsoft.

Benefits
Solves authentication failures in hybrid Microsoft identity environments.
Ensures proper separation of sending identity (email) and authentication identity (UPN).
Simple, non-disruptive change to existing workflows.
Conclusion
This enhancement makes Odoo 12 more compatible with Microsoft Outlook configurations where UPN and email addresses differ. It's a targeted, practical fix for a real-world issue in enterprise deployments.
Comments