SuiteCRM 8.5 Unable to send email using SMTP.Office365.com server in OUTBOUND EMAIL ACCOUNT

Hi,

I have created the Microsoft External OAuth Provider and External OAuth Connection using the steps given in the reference document.

All the required permissions mentioned in the document are provided to the Azure App and enabled the SMTP settings too.

**SMTP details are as follows: **
SERVER: smtp.office365.com
USE SMTP AUTHENTICATION?: true
Port: 587
MAIL SMTP/SSL: TLS
USERNAME: myemailid
Password: mypassword

Problem:
When I try to use this SMTP as a OUTBOUND EMAIL ACCOUNT. i’m not able to send the emails through it.

Error Log:
3: Connection: opening to smtp.office365.com:587, timeout=300, options=array()
3: Connection: opened
2: SERVER → CLIENT: 220 PN2PR01CA0216.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 25 Jul 2024 07:42:30 +0000 [08DCAC4EFBDD772D]

1: CLIENT → SERVER: EHLO localhost

2: SERVER → CLIENT: 250-PN2PR01CA0216.outlook.office365.com Hello [223.31.8.150]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

1: CLIENT → SERVER: STARTTLS

2: SERVER → CLIENT: 220 2.0.0 SMTP server ready

1: CLIENT → SERVER: EHLO localhost

2: SERVER → CLIENT: 250-PN2PR01CA0216.outlook.office365.com Hello [223.31.8.150]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

1: CLIENT → SERVER: AUTH LOGIN

2: SERVER → CLIENT: 334 VXNlcm5hbWU6

1: CLIENT → SERVER: —obfuscated—
2: SERVER → CLIENT: 334 UGFzc3dvcmQ6

1: CLIENT → SERVER: —obfuscated—
2: SERVER → CLIENT: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [PN2PR01CA0216.INDPRD01.PROD.OUTLOOK.COM 2024-07-25T07:42:39.477Z 08DCAC4EFBDD772D]

1: SMTP ERROR: Password command failed: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [PN2PR01CA0216.INDPRD01.PROD.OUTLOOK.COM 2024-07-25T07:42:39.477Z 08DCAC4EFBDD772D]

3: SMTP Error: Could not authenticate.
1: CLIENT → SERVER: QUIT

2: SERVER → CLIENT: 221 2.0.0 Service closing transmission channel

3: Connection: closed
3: SMTP Error: Could not authenticate.

Can anyone help. What am I missing here.

For outbound you have to create an “app password” for each user and use that as outbound connection. Your Azure login/password will not work. There is also a setting in Azure to allow this or not. If this is not allowed, even creating an app password will connect for outbound.

I am running into the same issue. Inbound with Office 365 and OAuth2 works like a charm, but sending e-mails result always in the same error message as initially mentioned:

3: Connection: opening to smtp.office365.com:587, timeout=300, options=array()
3: Connection: opened
2: SERVER → CLIENT: 220 FR4P281CA0385.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 12 Dec 2024 16:38:57 +0000 [08DD1A1CE69F254E]

1: CLIENT → SERVER: EHLO mycustomer.einfachinnovativ.com

2: SERVER → CLIENT: 250-FR4P281CA0385.outlook.office365.com Hello [217.26.51.25]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

1: CLIENT → SERVER: STARTTLS

2: SERVER → CLIENT: 220 2.0.0 SMTP server ready

1: CLIENT → SERVER: EHLO mycustomer.einfachinnovativ.com

2: SERVER → CLIENT: 250-FR4P281CA0385.outlook.office365.com Hello [217.26.51.25]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8

1: CLIENT → SERVER: AUTH LOGIN

2: SERVER → CLIENT: 334 VXNlcm5hbWU6

1: CLIENT → SERVER: —obfuscated—
2: SERVER → CLIENT: 334 UGFzc3dvcmQ6

1: CLIENT → SERVER: —obfuscated—
2: SERVER → CLIENT: 535 5.7.139 Authentication unsuccessful, user is locked by your organization’s security defaults policy. Contact your administrator. [FR4P281CA0385.DEUP281.PROD.OUTLOOK.COM 2024-12-12T16:39:03.518Z 08DD1A1CE69F254E]

1: SMTP ERROR: Password command failed: 535 5.7.139 Authentication unsuccessful, user is locked by your organization’s security defaults policy. Contact your administrator. [FR4P281CA0385.DEUP281.PROD.OUTLOOK.COM 2024-12-12T16:39:03.518Z 08DD1A1CE69F254E]

3: SMTP Error: Could not authenticate.
1: CLIENT → SERVER: QUIT

2: SERVER → CLIENT: 221 2.0.0 Service closing transmission channel

3: Connection: closed
3: SMTP Error: Could not authenticate.

Just to mention it: changing the security policy is not an option. Sorry! :frowning:

So any updates on this case?

Cheers,
Carsten

As I understand it, MS will be completely eliminating SMTP connections shortly. Currently there is no other outbound option in SuiteCRM to use Office 365. Unless someone develops an Oauth connections for outbound, you’ll have to find another solution for outbound like Sendgrid or something.

Thank you @pstevens for you feedback.