Microsoft 365 Email Provider "Error sending email: Bad Request - Error in query syntax"

Overview

When setting up Microsoft 365 as a Custom email provider and testing via the Send Test Email button on the Custom Email Provider page, the test email is sent successfully.

However, an error occurs when sending an email through the Universal Login page.

The error message displayed in the logs is:

Type FN error: Error sending email: Bad Request - Error in query syntax

Applies To

  • Microsoft 365 Email Provider
  • Error

Cause

The format of the FROM field is not supported by Microsoft 365.

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 Branding > Email provider > Email provider’s settings.
  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.