# SMTP setting problem with Office365

**URL:** https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630
**Category:** Self-hosting
**Created:** [April 26, 2017, 10:20am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630 "2017-04-26T10:20:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jianwei.lu](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jianwei.lu](https://meta.discourse.org/u/jianwei.lu)
#### Post date: [April 26, 2017, 10:20am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/1 "2017-04-26T10:20:44Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 26, 2017, 3:11pm UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/2 "2017-04-26T15:11:11Z")

</div>

> [@jianwei.lu](#):
>
> DISCOURSE\_SMTP\_PASSWORD: “xxxxxxxx"

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

---

<div class="post-metadata">

### Author: ![jianwei.lu](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jianwei.lu](https://meta.discourse.org/u/jianwei.lu)
#### Post date: [April 27, 2017, 1:55am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/3 "2017-04-27T01:55:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [April 27, 2017, 2:06am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/4 "2017-04-27T02:06:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ianwhite](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ianwhite/32/121793_2.png) [@ianwhite](https://meta.discourse.org/u/ianwhite)
#### Post date: [February 16, 2019, 11:52am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/5 "2019-02-16T11:52:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 11, 2022, 2:02am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/6 "2022-03-11T02:02:24Z")

</div>



---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 10, 2022, 2:02am UTC](https://meta.discourse.org/t/smtp-setting-problem-with-office365/61630/7 "2022-04-10T02:02:43Z")

</div>

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