Setting up SMTP

Hello people of discourse :smiley:

I’ve been trying for a while to get my SMTP routing working, and now I’m getting an interesting issue when I check mailgun send logs. It finally goes through, but it tries to send to what appears to be a redundant email. This is the send log.

{
  "severity": "permanent",
  "tags": [],
  "delivery-status": {
    "retry-seconds": 14400,
    "message": "Unable to connect to MX servers: [example.com]",
    "code": 499,
    "description": "Unable to connect to MX servers: [example.com]",
    "session-seconds": 0
  },
  "envelope": {
    "targets": "bar@example.com",
    "transport": "smtp",
    "sender": "postmaster@mg.mechanatrix.com"
  },
  "recipient-domain": "example.com",
  "id": "it was a random string..but i figure security",
  "campaigns": [],
  "reason": "old",
  "user-variables": {},
  "flags": {
    "is-routed": null,
    "is-authenticated": true,
    "is-system-test": false,
    "is-test-mode": false
  },
  "log-level": "error",
  "timestamp": 1443525153.274898,
  "message": {
    "headers": {
      "to": "myuser@gmail.com, bar@example.com",
      "message-id": "20150928231513.16585.98440@mg.mechanatrix.com",
      "from": "Excited User <mailgun@discourse.mechanatrix.com>",
      "subject": "Hello"
    },
    "attachments": [],
    "recipients": [
      "myuser@gmail.com",
      "bar@example.com"
    ],
    "size": 549
  },
  "recipient": "bar@example.com",
  "event": "failed"
} 

*I’ve replaced my email with myuser@gmail.com
as you can see, its sending to bar@example.com

This is whats in my app.yml

DISCOURSE_DEVELOPER_EMAILS: 'myuser@gmail.com'

## TODO: The domain name this Discourse instance will respond to
DISCOURSE_HOSTNAME: 'discourse.mechanatrix.com'

## TODO: The mailserver this Discourse instance will use
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.com         # (mandatory)
DISCOURSE_SMTP_PORT: 465                          # (optional)
DISCOURSE_SMTP_USER_NAME: myuser@gmail.com      # (optional)
DISCOURSE_SMTP_PASSWORD: myPassword             # (optional, WARNING the c$
#DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

Sorry everyone for the pretty newb question :yum:

Did you rebuild the container after changing your e-mail address in app.yml? A quick ./launcher rebuild app should do the trick.

yep. I have a different error now though, that comes from sidekiq logs.

Any Idea what this might mean?

The SSLError means that mailgun needs to lrn2ssl – the connection to smtp.mailgun.com is presenting a certificate for *.mailgun.org, which isn’t the same thing at all. The ReadTimeout errors seem more like network problems; likely a flaky connection.

3 Likes

it looks like mailgun has dropped ssl from their pop3 protocol due to POODLE vulnerability. (Don’t know what that is exactly…) Is there a way to disable SSL to avoid moving to another mail server, or is this something that’s required? Again, sorry for the complete newbness :yum:

If you want to disable TLS, you need to uncomment this line, and set it to false:

#DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

However, there’s no relationship between POODLE and newer TLS protocol versions, nor is there any relationship between SMTP and POP3. Mailgun does support TLS on SMTP connections, they just don’t support it correctly.

1 Like

Thank you so much for the help! I ended up migrating to mandrill for the sake of simplicity though. Emails went through after updating the SMTP address server side. Parts working together is a beautiful thing! :yum:

2 Likes