Mail for Ghost

I just finished in 15 minutes something I had been putting off for two years: setting up email for my Ghost blog. Granted I haven't been using this space all that much, but still it haunted me. Anyway, it was easy, turns out I messed up the verification settings from Mailgun originally, and just never returned to it.

But let me take a step back, what is Mailgun and why am I using it? Unlike WordPress or other PHP applications hosted in a LAMP environment, Ghost is built on Node.js. Often times with node.js apps you have to configure email manually. Mailgun is a web-based tool that allows you to send, receive and track emails. So rather than configuring your own email server, it's usually easier to use a hosted service that lets you to send and receive mail through an application like Ghost.

So, to set it up you need to create an account on a transactional email service like Mailgun (others include Sparkpost, Mandrill, SendGrid, etc.). After that, you set up an account for your site domain and get the credentials to send mail over SMTP. Below you can see the SMTP settings I needed to enter into Ghost's config.js file:

SMTP Settings

Here is the config.js file with the settings:
Config.js

The other step to enable sending mail is verifying the SMTP settings through DNS. You would do this in the DNS settings where ever your domain is registered. In this example for Mailgun, you need to create two TXT records that should enable you to send mail.

DNS Verification

Most folks only need to send mail via the application for password resets, etc., but if you need to receive mail, track unsubscribers, etc. you can create the following CNAME for tracking.
CNAME Tracking

And here are the MX records for receiving email through Mailgun.
screenshot-2016-09-13-21-39-12

And that's it. It really wasn't all that hard in the end, I think I had issues wrapping my head around the whole idea of transactional email for specific apps driven my APIs, but that is slowly sinking in. Did I mention slowly?


Image credit: Bill Smith's "Acredale decommissioned mailboxes".