Updating ghost blog SMTP settings

Updating ghost blog SMTP settings

I’ve had an issue recently with my ghost blog not sending out emails in a timely fashion, the emails going to the junk folder or emails not arriving for some people. I want to fix this once and for all and future proof those emails against going into the ether, never to be seen again.

I did some research and I found that there are 2 methods that ghost uses for outbound SMTP sending. Option 1 is a transactional method normally used for sending low volumes of emails which is generally to a single recipient for things such as Member newsletter signup/account creation or staff invite links for additional blog writers to use. The second method is a bulk email method used for sending to large volumes of recipients and this is typically when you’re sending out newsletters to all the subscribers etc. Today, I’m primarily concerned about setting up method 1 so that I can get additional writers or members signing up for my blog.

First thing we need to do is understand how to update the transactional email settings for a ghost blog. I’ve luckily become familiar with this method after hosting a couple of different ghost blogs now, but I will take you through how to find the config file that dictates the SMTP settings. Start off by logging onto your ghost server and ensure you the text editor of your choice installed. Browse to your install location for your ghost blog (typically this could be /var/www/ghost) and look for a file called “config.production.json". I’m using a docker instance for hosting my ghost blog so I am executing the below command to connect into my ghost container and it takes me directly to the location I’m looking for:

sudo docker exec -it ghost-itgo /bin/bash

If you’re still having trouble finding your file, you can run the following commands to search your whole server for the file.

find / -name "config.production.json"

Once you’ve found the file, open it with your text editor and let’s look for our mail settings. The default settings we’re looking for, will appear as below:

"mail": {

"transport": "Direct"

}

We will want to change this to look like the below config file:

"mail": {

"transport": "SMTP",

"options": {

"service": "SMTP2Go",

"host": "mail.smtp2go.com ",

"port": 443,

"secureConnection": true,

"auth": {

"user": "domain.example",

"pass": "1234567890"

}

}

},

Before you save these changes however, you will need to get a valid username & password to use for sending emails. Browse across to SMTP2GO - SMTP Service Pricing & Signup and then slide the slider all the way to the left so you can get access to the free plan as per the screenshot below.

Once you’ve registered, open the following link to add your registered domain: SMTP2GO | Sender Domains. It will look something like the below screenshot, and you’ll need to add these values into your DNS provider then verify the domain. I would also however recommend 1 additional DNS record which isn’t noted in the below screenshot that has caused issues for me in the paste.

v=spf1 include:spf.smtp2go.com ~all

Now that you’ve verified the domain, you can create users to start sending out emails. Browse to SMTP Users (SMTP2GO | Manage Users) and then create a user and return to the config file we were editing earlier. Paste your username/password into the config file you still had open from earlier and then save the file and reboot your ghost server to apply those settings.

You can now send out emails without worrying about them disappearing into the ether! Enjoy!

Show Comments