Can't set DISCOURSE_SMTP_AUTHENTICATION: login

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

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

Bump, forgot to add support category

You need to destroy and then start

1 Like

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.

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

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.

I can telnet in but it immediately closes the connection

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

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.

iptables -S OUTPUT

That’s probably OK, then.

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?

iptables -S OUTPUT

-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

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

1 Like

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

1 Like