Troubleshooting tips for email on Localhost (Members from address, ETIMEDOUT errors)

It took me a bit to get email working on localhost with Ghost 3.0. Here are my solutions.

ETIMEDOUT out errors

Some ISPs block outgoing port 25. I changed the mail port to 587, and that fixed it. If you’re using SMTP, your mail config will look something like this:

"mail": {
  "transport": "SMTP",
  "options": {
    "port": 587,
    "host": "smtp.postmarkapp.com",
    "service": "Postmark",
    "auth": {
      "user": "...",
      "pass": "..."
    }
  }
 }

Members emails not getting delivered, other email working fine

Ghost lets you set the first part of the from email address for members emails, but but last part is always your blog url. If you’re using something like Postmark for email, though, you’ll get errors saying that “noreply@localhost” is not valid from address.

My quick hack — after grep -r "noreply@" . — was to open up versions/3.0.0/core/server/services/mail/GhostMailer.js and replace:

return address;

with:

return "myemail@mydomain.com";

And restart ghost.

I am sure there is a more official way to change entire Members from address (if you know what it is, please let me know!), but this works well enough for testing.

You can configure that in your members email settings! It’s a bit buried in the docs, but here’s the anchor:

1 Like

Thanks for the reply @vikaspotluri123! Yes, I have that set in my config.development.json, right above transport (I didn’t include it in the public post for privacy & simplicity). But for some reason that doesn’t seem to override the noreply@localhost address for members emails. Any idea what I might be doing wrong?

Sorry if I wasn’t clear,

If you go to the members settings in the admin interface, one of the accordions is “Email settings” - you can set the from address there :slight_smile:

1 Like

As far as I can tell, you can only update part of the from email address from the email settings pane of the admin panel:

I can update “noreply” to whatever I want. The “@localhost:2369” part is greyed out, and not user editable. And it’s the “@localhost” that makes it an invalid from address, from Postmarks perspective. Maybe I’m just dense?

Ooh, you’re right… I didn’t think of that!

I guess you could get around this by having a domain that points to localhost (e.g. localhost.yourdoma.in) and running ghost config set url http://localhost.yourdoma.in -D)

Then, you would just do dev on localhost.yourdoma.in:2368

1 Like

Yes, that would be more elegant :slight_smile: I don’t know why I didn’t think of using /etc/hosts for that; I’m already using it to block HN and Twitter…

1 Like

The /etc/hosts method works.

It’s a bit inconvenient, though, because Postmark et al require you to use a valid email address on a domain that you control.

So, I either loose access to whatever valid domain I want to point to localhost … or I use email@localhost.mydoma.in but first have to a) set up the “localhost” subdomain, and b) set up the “email” email address. :crazy_face: