SMTP setting problem with Office365

I encounter a problem when I try to set the Email SMTP using Office365 online email server.

the SMTP setting of Office365 is:

Server name: smtp.partner.outlook.cn
Port: 587
Encryption method: STARTTLS

The discourse’s SMTP setting in the container/app.yml as below:

DISCOURSE_SMTP_ADDRESS: smtp.partner.outlook.cn
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: xxxx@xxxx.com
DISCOURSE_SMTP_PASSWORD: “xxxxxxxx"
DISCOURSE_SMTP_ENABLE_START_TLS: true       

The email can not be sent, and I found a error message in logs:

Sent mail to receiver@abc.com (5739.7ms)
Job exception: 504 5.7.4 Unrecognized authentication type [SHAPR01CA004.CHNPR01.prod.partner.outlook.cn]

and I also tried this way, still doesn’t work:

DISCOURSE_SMTP_ADDRESS: xxxx-com.mail.protection.partner.outlook.cn
DISCOURSE_SMTP_PORT: 25
DISCOURSE_SMTP_USER_NAME: xxxx@xxxx.com
DISCOURSE_SMTP_PASSWORD: “xxxxxxxx"
DISCOURSE_SMTP_ENABLE_START_TLS: false          # (optional, default true)

Anyone can help me?

In this line I noticed the first quotation mark is not the ASCII quotation mark of code 0x22, it is a Chinese one.

1 Like

Oh, yes. It’s my mistake when I edit this post, but not happened in the real environment.
Thanks!

Presumably the set of authentication options which office365 supports doesn’t include any of the options that Discourse (or, rather, the SMTP library that Discourse uses) supports. What authentication modes does Office365 support?

Also, note that we don’t recommend using a mailbox provider such as Office365 or gmail for outgoing e-mail, as it is usually a violation of the provider’s terms of service, and often balks at sending the volume of mail that Discourse generates.

1 Like

I have been setting up an SMTP relay for an Office365 server, and eventually found the following combination to work. The setup on the O365 side was a whitelisted domain.

DISCOURSE_SMTP_ADDRESS: <yourdomainkey>.mail.protection.outlook.com
DISCOURSE_SMTP_PORT: 25
DISCOURSE_SMTP_DOMAIN: <yourdomain>
DISCOURSE_SMTP_ENABLE_STARTTLS_AUTO: true

Hope that helps.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.