top of page

Resolve Outgoing Email in Odoo 12-18 with Microsoft Outlook UPN (Authentication Issue)

  • Writer: John Julius Danker  Khoo
    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


  1. Update outlook scope url, create a custom field outlook_upn

IrMailServer Model
IrMailServer Model
  1. use outlook upn for generating oauth, update token value whether fail or success

function _smtp_login()
function _smtp_login()
  1. Ensure Url is HTTPS, add tenant id information as endpoint

fetch_outlook_token()
fetch_outlook_token()
  1. Lastly, ensure server running is https as per requirement by Microsoft.

compute_outlook_url()
compute_outlook_url()

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


Subscribe Form

  • facebook
  • linkedin

©2019 by Excelroot Technology Sdn Bhd.

bottom of page