Transactional Emails Not Working

I am running self-hosted on Linode server and having issues with all transactional emails. Bulk email works just fine for sending newsletter (through Mailgun).

I edited my config.production.json for my mailgun SMTP credentials:

"mail": {
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 587,
      "secureConnection": false,
      "auth": {
        "user": "user",
        "pass": "password"
      }
    }
  },

However, staff invites, member signup, and member login all result in endless spinner and an error message.

Where do I start to try and fix these issues? Are there logs I can look at to get more information on problem?

Getting the following errors in ghost log

[2022-03-01 10:00:30] ERROR

NAME: EmailError
CODE: ETIMEDOUT
MESSAGE: Failed to send email. Reason: Connection timeout.

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: Connection timeout
    at createMailError (/var/www/<sitename>/versions/4.35.0/core/server/services/mail/GhostMailer.js:67:12)
    at SMTPConnection._formatError (/var/www/<sitename>/versions/4.35.0/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
    at SMTPConnection._onError (/var/www/<sitename>/versions/4.35.0/node_modules/nodemailer/lib/smtp-connection/index.js:770:20)
    at Timeout.<anonymous> (/var/www/<sitename>/versions/4.35.0/node_modules/nodemailer/lib/smtp-connection/index.js:229:22)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)

I think the problem is due to the VPS host, Linode, blocking mail ports including 587. To have those opened up, you have to open a support ticket in Linode and give them some information.

I’ve seen other similar questions to mine with no replies/solutions so want to keep this updated as reference for others who may have the same issue.

Don’t see how to mark something as the solution, but this was indeed the solution to issue. If you’re having issues with transactional email, may want to look into whether those ports are open or if they’ve been blocked.

Not sure why Ghost doesn’t just use API for transactional email though. At least as an option would be nice.

You have wrong endpoint in your config. You should include region, like smtp.eu.mailgun.org. Please look for old thread for complete solution: Ghost service reliably crashes when sending transaction email test

Is it? It is working fine now after having the mail ports opened up. smtp.mailgun.com is the one officially listed in mailgun docs and in the UI

I am in the US, not Europe, so perhaps they separate the service by region, and default for US

My issue resolved. Changing secure connection port from “587” to “465” as mentioned here by @rozhok got my transactional emails working.

I’m not sure the two things were connected. But thanks to @rozhok in any case.

1 Like

If you are having problems with sending Transactional email. You can use AWS SES! It’s easy to setup and configure. Moreover, its very cheap compared any other services out there.