Microsoft 365 Email Provider "Error sending email: " for Passwordless Users

Overview

When setting up Microsoft 365 as a Custom email provider and sending emails to Passwodless users, the following error message is displayed in the logs without giving any details:

Error sending email:

Applies To

  • Custom Email Provider
  • Microsoft 365
  • Passwordless users

Cause

For Microsoft 365 providers, the Microsoft Graph API’s sendMail endpoint is utilized. The sendMail endpoint is designed to accept the following HTTP requests:
POST /users/{id | userPrincipalName}/sendMail

  • id - This refers to the user’s unique identifier in Azure Active Directory (AAD).
  • userPrincipalName (UPN) - This is typically the user’s email address and serves as their user principal name in Azure Active Directory. It’s a user-friendly identifier often the same as the user’s primary email address.

Solution

To resolve the email sending error in the Universal Login page, the format of the FROM field needs adjustment to comply with the Microsoft 365 requirements. Modify the FROM field to contain only the email address instead of the application’s name and the email.

  1. Access Authentication > Passwordless.
  2. Locate the FROM field, which currently is set as below:
    {{ application.name }} <no-reply@example.com>
    
  3. Change this to the FROM to match the pattern below:
    no-reply@example.com
    
  4. Press Save.

After making these changes, test sending an email again through the Universal Login page to ensure the issue is resolved.