Error Sending emails O365

Version ie <v5.10.30>

5.11.28

Environment <Docker/Shared Hosting/Zip/Other>

Shared Hosting

Checklist

  • Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com or Invoice Ninja?
  • Have you searched existing issues?
    Email where not send to check all settings
  • Have you inspected the logs in storage/logs/laravel.log for any errors?

Describe the bug

Steps To Reproduce

Send email
Change already with O365 support specialist all settings of O365

Expected Behavior

Additional context

Screenshots

Logs

[2025-02-03 17:49:05] production.INFO: Mailer failed with a Transport Exception Expected response code “250/251/252” but got code “550”, with message “550 5.7.64 TenantAttribution; Relay Access Denied [ValidationStatus of ‘’ is EmptyCertificate] [AM3PEPF00009B9B.eurprd04.prod.outlook.com 2025-02-03T17:49:05.267Z 08DD403C60B7C3D3]”.
[2025-02-03 17:49:05] production.INFO: Trying to send to [email protected] 2025-02-03 17:49:05

Hi,

I’d assume it’s a problem with the credentials. I found this post with a similar error, which mail driver are you using?

Sorry then I keep getting
[2025-02-03 19:13:16] production.INFO: Mailer failed with a Transport Exception Failed to authenticate on SMTP server with username “[email protected]” using the following authenticators: “LOGIN”, “XOAUTH2”. Authenticator “LOGIN” returned “Expected response code “235” but got code “535”, with message “535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [AM0PR02CA0115.eurprd02.prod.outlook.com 2025-02-03T19:13:00.835Z 08DD435B0BB3986C]”.”. Authenticator “XOAUTH2” returned “Expected response code “235” but got code “535”, with message “535 5.7.3 Authentication unsuccessful [AM0PR02CA0115.eurprd02.prod.outlook.com 2025-02-03T19:13:11.038Z 08DD435B0BB3986C]”.”.

Even when settings the settings like this in the env file

MAIL_MAILER=smtp
MAIL_HOST=servitweb-be.mail.protection.outlook.com
MAIL_PORT=587
MAIL_USERNAME= → email address is filled in
MAIL_PASSWORD=‘’ → is between ‘’ because it has a ! and $ inthe password
MAIL_ENCRYPTION=TLS
[email protected]
MAIL_FROM_NAME=“Info Servitweb”

The post above suggests changing this value from smtp to mail, you may also want to test with a simpler password to see if it helps.

Yes changed the transport but still the same. It has been working before and since last update failure it doesn’t work any. Also have case open with Microsoft but Tenant partner also don’t find anything strange.

You may want to ask in a discussion on GitHub

This should help to configure smtp auth:

Enable/disable smtp auth for exchange globally or for a specific mailbox:

smtp.office365.com needs to be used for the MAIL_HOST. Apart of this your config looks correct for option 1.

servitweb-be.mail.protection.outlook.com can be used with port 25 only for the options 2 & 3

1 Like