# Using exchange as SMTP doesn't work

**URL:** https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073
**Category:** Self-hosting
**Created:** [April 23, 2020, 10:41pm UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073 "2020-04-23T22:41:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Zuki\_Zuk\_Aka\_Tovo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zuki_zuk_aka_tovo/32/142837_2.png) [@Zuki\_Zuk\_Aka\_Tovo](https://meta.discourse.org/u/Zuki_Zuk_Aka_Tovo)
#### Post date: [April 23, 2020, 10:41pm UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073/1 "2020-04-23T22:41:45Z")

</div>

Hi,  
Newcomer here. With a fresh install, I’m trying to get me confirmation email but I’ stuck.  
I know that our smtp server is an exchange one.  
As advised, I’ve put the **DISCOURSE\_SMTP\_AUTHENTICATION** parameter to _login_ instead of _plain_  
I’ve followed the procedure described here: [https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326/2](https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326/2)  
I’ve tried potential fixes here  
[https://meta.discourse.org/t/smtp-exchange-server-problem/27826](https://meta.discourse.org/t/smtp-exchange-server-problem/27826) and there  
[https://meta.discourse.org/t/smtp-connection-problem-docker-installation/41981](https://meta.discourse.org/t/smtp-connection-problem-docker-installation/41981)  
But I still have the discourse-doctor error:  
UNEXPECTED ERROR  
504 5.7.4 Unrecognized authentication type

Any help will be really appreciated.  
Thanks

---

<div class="post-metadata">

### Author: ![Zuki\_Zuk\_Aka\_Tovo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zuki_zuk_aka_tovo/32/142837_2.png) [@Zuki\_Zuk\_Aka\_Tovo](https://meta.discourse.org/u/Zuki_Zuk_Aka_Tovo)
#### Post date: [April 25, 2020, 2:24pm UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073/2 "2020-04-25T14:24:54Z")

</div>

Well,  
I have to go further so I tried a workaround by installing a posftix on my host in order to relay messages from discourse. I have an issue related to my lack of expertise on docker.  
My configuration:

- Host network:  
docker0: \<NO-CARRIER,BROADCAST,MULTICAST,UP\> mtu 1500 qdisc noqueue state DOWN gro up default  
link/ether 02:42:78:b6:18:3c brd ff:ff:ff:ff:ff:ff  
inet 172.17.0.1/16 scope global docker0  
Discourse network:  
“Gateway”: “172.18.0.1”,  
“IPAddress”: “172.18.0.3”,  
“IPPrefixLen”: 16,

- Postifx:  
`mynetworks = 172.16.0.0/12, 127.0.0.0/8`

- container/app.yml:  
DISCOURSE\_SMTP\_AUTHENTICATION: none  
DISCOURSE\_SMTP\_ADDRESS: 172.17.0.1  
DISCOURSE\_SMTP\_PORT: 25

**discourse-doctor gives:**  
=== ERROR ===  
CONNECTION REFUSED  
Connection refused - connect(2) for “172.17.0.1” port 25  
Where is my fault?

---

<div class="post-metadata">

### Author: ![mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mik](https://meta.discourse.org/u/mik)
#### Post date: [April 30, 2020, 1:11am UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073/3 "2020-04-30T01:11:09Z")

</div>

Please try this configuration in your app.yml file:

```
DISCOURSE_SMTP_AUTHENTICATION: login
DISCOURSE_SMTP_ADDRESS: smtp.example.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: "yourusername"
DISCOURSE_SMTP_PASSWORD: "yourpassword"
DISCOURSE_SMTP_ENABLE_START_TLS: true
DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none

```

And at the end of the file:

` - exec: rails r "SiteSetting.notification_email='yourusername@example.com'"`

Please note that the DISCOURSE\_SMTP\_USER\_NAME and the username part of the mail in SiteSetting.notification\_email is the same.

If you use for example [noreply@example.com](mailto:noreply@example.com) sometimes it does not work because of some security checks which are activated on the server that make sure that the username is corresponding to the user email.

Hope it could help.

---

<div class="post-metadata">

### Author: ![Zuki\_Zuk\_Aka\_Tovo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zuki_zuk_aka_tovo/32/142837_2.png) [@Zuki\_Zuk\_Aka\_Tovo](https://meta.discourse.org/u/Zuki_Zuk_Aka_Tovo)
#### Post date: [April 30, 2020, 1:55pm UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073/4 "2020-04-30T13:55:41Z")

</div>

Thanks Mik,  
That solved my issue.

---

<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: [May 30, 2020, 1:56pm UTC](https://meta.discourse.org/t/using-exchange-as-smtp-doesnt-work/149073/5 "2020-05-30T13:56:04Z")

</div>

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