# Can't set DISCOURSE\_SMTP\_AUTHENTICATION: login

**URL:** https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461
**Category:** Self-hosting
**Created:** [October 28, 2021, 9:42pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461 "2021-10-28T21:42:51Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 28, 2021, 9:42pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/1 "2021-10-28T21:42:51Z")

</div>

Hi I’m having trouble sending mail. I use mailjet and I’m getting the error

```plaintext
Connection reset by peer

```

So now I’m trying to set `DISCOURSE_SMTP_AUTHENTICATION: login` in `app.yml`. Maybe this will fix the issue.

I ran `./launcher restart app` afterwards, but when running `discourse-doctor` again it says `with plain auth` again

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 28, 2021, 10:34pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/2 "2021-10-28T22:34:30Z")

</div>

Bump, forgot to add support category

---

<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: [October 29, 2021, 1:08am UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/3 "2021-10-29T01:08:31Z")

</div>

> [@drat3](#):
>
> I ran `./launcher restart app` afterward

You need to destroy and then start

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 29, 2021, 12:39pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/4 "2021-10-29T12:39:00Z")

</div>

Thanks that worked, but it seems I was fixing the wrong thing it still says  
`Job exception: Connection Reset by peer`

I have no idea where to look to fix it. I’m using digitalocean and sending on port 587. I’ve switched it back to plain auth cause apparently you have to in mailjet. TLS is optional according to them, but I’ve tried with and withouth TLS alas. I really don’t know what to change anymore, I’ve tried with double ticks around the password and withouth. I’ve double checked uname and pwd as well.

```plaintext
DISCOURSE_DEVELOPER_EMAILS: 'user@email.com'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ADDRESS: in-v3.mailjet.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: uname
  DISCOURSE_SMTP_PASSWORD: pwd
  DISCOURSE_SMTP_ENABLE_START_TLS: true
  DISCOURSE_SMTP_DOMAIN: radstarter.io
  DISCOURSE_NOTIFICATION_EMAIL: noreply@radstarter.io
  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

```

Any help is appreciated

---

<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: [October 29, 2021, 2:07pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/5 "2021-10-29T14:07:41Z")

</div>

You can see if `telnet in-v3.mailjet.com 587` connects or times out. If it times out, then you have that outgoing port blocked so you’ll need to use a different port (2525 might work for mailjet, but I don’t know) or you’ll need to get Digital Ocean to stop blocking the port.

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 29, 2021, 2:21pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/6 "2021-10-29T14:21:07Z")

</div>

I can telnet in but it immediately closes the connection

```plaintext
~# telnet in-v3.mailjet.com 587
Trying 104.199.96.85...
Connected to in.mailjet.com.
Escape character is '^]'.
Connection closed by foreign host.

```

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [October 29, 2021, 2:56pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/7 "2021-10-29T14:56:02Z")

</div>

If there is a firewall involved, that connected line might be misleading. It could just be reporting that it has successfully connected to something when trying that domain (`in-v3.` is an alias to `in.`) but that something is the firewall which is then closing the connection.

Another one you could try is `telnet smtp-relay.gmail.com 587`. If that fails in the same way, I’d think it’s likely the port is blocked on your Digital Ocean server. This may be a firewall outside of your server or firewall software running on your server.

For the former, you may be able to control this from somewhere in your account’s control panel or you may need to contact them. For the latter it’s probably `iptables`, you can use the following command to see if that’s the case and list the rules that apply to outbound connections.

```plaintext
iptables -S OUTPUT

```

---

<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: [October 29, 2021, 3:00pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/8 "2021-10-29T15:00:20Z")

</div>

> [@drat3](#):
>
> I can telnet in but it immediately closes the connection

That’s probably OK, then.

> [@Simon\_Manning](#):
>
> ```plaintext
> iptables -S OUTPUT
> 
> ```

If he’s blocked, it’s almost certainly done at the network level outside of the droplet’s OS. (Unless he set up a firewall to block himself without knowing.)

There are a bunch of mailjet topics. Have you looked at those?

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 29, 2021, 3:40pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/9 "2021-10-29T15:40:54Z")

</div>

`iptables -S OUTPUT`

```plaintext
-P OUTPUT ACCEPT
-A OUTPUT -j ufw-before-logging-output
-A OUTPUT -j ufw-before-output
-A OUTPUT -j ufw-after-output
-A OUTPUT -j ufw-after-logging-output
-A OUTPUT -j ufw-reject-output
-A OUTPUT -j ufw-track-output

```

gmail smtp works flawlessly

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 29, 2021, 3:54pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/10 "2021-10-29T15:54:48Z")

</div>

Yes checked a lot of mailjet topics, none of them are a problem to my solution

---

<div class="post-metadata">

### Author: ![drat3](https://avatars.discourse-cdn.com/v4/letter/d/5f8ce5/32.png) [@drat3](https://meta.discourse.org/u/drat3)
#### Post date: [October 29, 2021, 4:56pm UTC](https://meta.discourse.org/t/cant-set-discourse-smtp-authentication-login/207461/11 "2021-10-29T16:56:22Z")

</div>

I used the one-click install, this is probably why it fails will delete the droplet and do a clean install

EDIT: It’s working, note _never use a one click installer_
