Using Gmail for Ghost Transactional Emails

I’m migrating my blog from ghost (older version) to ghost (new version). The server I was previously hosted on had its own mail transport agent, so I didn’t really have to worry about sending emails (or, at least it just worked). Now, however, I need to setup an email system.

I have 0 members, so bulk email isn’t a concern at this time. However, transactional emails (user signups, etc…) are not going through. I have set up my config.production.json file as follows:

  "mail": {
    "from": "my-address@gmail.com",
    "transport": "SMTP",
    "options": {
      "service": "Gmail",
      "host": "smtp.gmail.com",
      "port": 587,
      "auth": {
        "user": "my-address@gmail.com",
        "pass": "a-configured-app-password"
      }
    }
  },

Ghost starts as I would expect, but when I try to sign up for a new account / subscribe, I get a message stating that it can’t send the magic link, after timing out.

Is there something I’m doing wrong here?

Working example:

Hi Cathy!

Thanks for the response. I actually used this as my configuration guide. Something still appears to be incorrect in the setup, though, because even with that exact configuration (with my passwords and such), I’m still getting no emails passed through.

1 Like

I’ve also tried setting it with a dreamhost email address (I also have an email address that’s @ my custom domain hosted by dreamhost). This doesn’t work, either, which leads me to believe there’s some kind of connection issue between my server and these SMTP servers. It’s a linode that I just set up with Ubuntu 20.04.

How would I go about diagnosing where the email is getting dropped?

I do see this in the syslog of my server, as well:

Jan 29 23:38:09 localhost node[19651]: [2024-01-29 23:38:09] #033[35mWARN#033[39m Error sending email: Failed to send email. Reason: Connection timeout. Please check your email settings and resend the invitation.

So I think that it’s not being able to send from the node side, which makes me think that perhaps the connection information isn’t correct.

Hi, when I used Google, I used the first part of this tutorial. It’s in Portuguese, but it’s easy to understand with a translator.
Hostinger

Trying the obvious: You restarted Ghost after changing the config file? You don’t have a firewall set up? Whoever your host is isn’t blocking your server’s outbound email?

Oh, and you might try starting Ghost with ghost run -D, which makes logging very verbose (spammy!) and might get you a more detailed error.

1 Like

Try adding the following, and restart Ghost.

 "secure": false,
      "requireTLS": true,

See the Nodemailer guide.

Your host is most likely blocking outgoing SMTP, fastmail has a proxy, SMTP-on-anyport, scroll all the way down…

The OP is using Hostinger, and port 587 isn’t blocked (all outgoing ports are open, except 0 and 25.)