Free Ghost Blog with Gmail Relay

by Elliott
5 minutes
Free Ghost Blog with Gmail Relay

Ghost blog is a powerful blogging package that can be installed or hosted a variety of ways. Recently I set it up as part of a solution for a non-profit. The blog costs $0 to setup and run beyond my time setting it up and an $8/yr domain name. Here is how I did it.

Hosting

I have installed Ghost on a virtual machine using "Oracle Cloud Free Tier". Setup and monthly hosting is truly free. You do have to enter credit card information but the card is not charged unless you use paid resources. And they make it simple to keep it free.

Email

Ghost blog is designed to rely on email for administration (transactional emails) as well as notifying users of new content (newsletter emails). Setting up a connection to an email server sadly is one of the toughest things to do with Ghost. The Ghost blog is optimized to work with paid bulk email providers. Some of these providers charge as much as $35 a month to deliver email. That will not do at all.

Since the non-profit I am working with has non-profit status with the IRS I was able to sign up for Google Workspace for Nonprofits. This service includes hosting the email service for the non-profit's domain. For the volunteers of this nonprofit they get to have an organization specific email address while enjoying the Gmail interface.

The blog then gets to use a Gmail email relay. This high quality and well trusted relay is simple to setup and despite what Ghost blog help states, will work with Ghost blog. Here is how you can set it up.

Google SMTP Relay SettingsAfter you get through he verification process and demo of Google Workspaces and set up your domain in Google you can activate the SMTP relay service. Go to the Admin console of the domain and navigate to Apps > Google Workspace > Settings for Gmail > Routing. Scroll down to 'SMTP relay service'. Click 'Add A Rule'. This is where you set the restrictions on how mail can be sent as someone from your nonprofit's domain. I recommend setting it as strict as possible.

All that is easy compared to getting Ghost blog to use this relay. Some of the guides you find in a search will not work because they were for another version. One I found had the wrong variable name for the mail server password. I ended up looking at the source code for the Node mailer module that Ghost uses to see what the variable should be. This solution works with Ghost version 5.28.

To get Ghost to use the Gmail relay you need to edit the config.production.json in the root directory of the Ghost software. Be careful editing this file. It is JSON format and requires strict syntax. Backup the file before editing it.

Below is the solution I found to put into my config file. Replace nonprofit.com with your domain name.

  "mail": {
"transport": "SMTP",
"from": "'Nonprofit Blog' <blog@nonprofit.com>",
"mailFrom": "'Nonprofit Blog' <blog@nonprofit.com>",
"options": {
"service": "Gmail",
"host": "smtp-relay.gmail.com",
"secure": true,
"name": "nonprofit.com",
"auth": {
"user": "blog@nonprofit.com",
"pass": "**************************************"
}
}
},

Once you save the changes to your config file, restart ghost.

Best of luck setting up Ghost blog with Gmail relay. Once it work it is a great system.