/ Ghost

Mail configuration for Ghost

Needed to setup email for my Ghost blog using Docker. Here I explain the few quite simple steps I had to do.

As it is well stated in Ghost documentation, Ghost needs mail configuration in order to send emails to users, including myself as the blog owner. This was something that was not included in my initial setup (see my earlier post). And obviously, something I wanted to fix. Fortunately, the steps needed are well documented here and quite easy to follow.

Here is a summary what I did:

  1. Selected my mail server provider.
  2. Updated my domain's name server records (DNS records) with the details given by my mail server provider.
  3. Updated my Ghost configuration file to reflect my account on the mail server provider.
  4. Restarted Ghost.

(1) For my mail service provider I chose Mailgun.com – as suggested in the documentation. Created an account there, verified my account details, entered credit card information for billing, and added subdomain mg.nopunen.fi for my nopunen.fi domain. Besides an affordable pricing, Mailgun provides a nice user interface and displays the DNS record settings I need in the next step.

(2) I then went to my domain name server provider's admin pages to enter the required DNS records for my domain's mail server. Earlier, I had chosen zoner.fi as my DNS provider. They also provide a decent interface to manage the DNS records. It was easy to cut and paste the required values from the previous step. After a short while waiting for the records to be propagated over the Internet my settings became verified by Mailgun. I was ready for the next step.

(3) Now I had a personal mail server up and running. Next thing was to configure Ghost to make use of that mail server. The configuration is in file config.production.json where the following JSON fragment were to be edited:

"mail": {
    "transport": "SMTP",
    "options": {
        "service": "Mailgun",
        "auth": {
            "user": "postmaster@mg.nopunen.fi",
            "pass": "xxxyyyzzz"
        }
    }
  } 

Obviously, the "xxxyyyzzz" stands for the password provided by Mailgun for me to send SMTP mail on my behalf. If you are a developer, you may want to update config.development.json as well. Also, as always, you need to be carefull with the JSON syntax.

There was one tiny detail though: I am using Docker and a ready made Docker image for Ghost. The configuration file resides in that image, so, instead of simply editing the file, I had to pull the config file out, edit it and then put it back:

To pull:

docker container cp ghost:/var/lib/ghost/config.production.json myconfig.production.json

Then edit myconfig.production.json using one's favourite editor.

Then put the file back:

docker container cp myconfig.production.json ghost:/var/lib/ghost/config.production.json

(4) Now everything was done, and I was ready to restart Ghost:

docker start ghost

Obviously, I did stop Ghost earlier, and yes, I also took a complete backup of my server, just in case.

Later, if and when I will get a new updated Docker image for Ghost, I need to re-apply the mail settings.

So what do I have now? Well, as said before, Ghost needs to send mail to reset author passwords as well as to invite and verify new members of the blogger team. Ghost already is able to manage the list of subscribers – a feature for me to consider later. However, the features to send mail to subscribers seems to be work to be done. We'll see.

Thanks for reading.