How to configure SendinBlue SMTP with Ghost CMS for transactional emails

Self-hosting Ghost CMS is great, but it leaves you without having an easy transactional email solution. Let's configure one so your new members can actually signup to your site.

How to configure SendinBlue SMTP with Ghost CMS for transactional emails

Ghost CMS is a great platform. It's super easy to use and setup and can be self-hosted in no time at all. If you host your Ghost site with Ghost directly, the emailing capabilities are all handled for you. For $9/month that's really not that bad of a deal considering the amount of work that goes into self-hosting.  (If you want to be able to upload custom themes, you will need a higher paid tier check Ghost Pricing)

I am self-hosted with a VPS, and I pay roughly $4/month for my VPS through SpartanHost. But that means I needed to find a solution for transactional emails. Transactional emails are the ones that you receive when you sign up for my site. If you want to see what a transactional email looks like, just go subscribe on the site really quick so you can get the full experience 😏.

Send-in SendinBlue

Solving the transactional email problem was fairly easy. There are a lot of options out there, such as Amazon SES, Elastic Email, Mailgun (which is required if you want to send Newsletters through Ghost) and of course SendinBlue.

Amazon SES was my first attempt. And although I was very close to getting it working, I kept running into some sort of issues and ultimately decided to try another solution. I am sure that I could go back and revisit and configure SES, but I wanted something I could literally plug in and forget about it.

SendinBlue is a SaaS digital marketing solution that offers more than just transactional SMTP email services. They have services such as chat, sms marketing, signup forms and even Facebook ads. Which was another appealing selling point for growth. Also, the pricing was fair and great for my site.

They start you out with a free 300 emails per day. Let's just say, if I exceed 300 emails a day in subscribers to my site, I think those are good problems to have 😁. The next tier up is $25/month for 25k emails and no daily limit. So even if I did run into that scenario, it's not going to break the bank for me.

With Sendinblue, I am able to solve my transactional email problem and at the same time keep my costs on running the site very minimal!

How-To Setup SendinBlue

This is actually pretty simple and shouldn't take long to complete. The first thing you need is, of course, a GhostCMS installation, a domain and a SendinBlue account.

Setting up SendinBlue is the easiest part, so after you have your GhostCMS installed, you will need to configure your SMTP within Sendinblue. \

Get Sendinblue Credentials

Login to the SendinBlue dashboard and get familiar with that on your own time, you have a tutorial to read! And make your way up to the top right where your name is. Click on that and then SMTP & API

After that you will want to click on the SMTP tab at the top of the screen to display the SMTP configuration information. Take note of your Login and Master password

So far, pretty easy right? Well, you should pat yourself on the back because you are halfway there. Hydrate up and get into the homestretch.

Configure GhostCMS Config File

Now we need to configure GhostCMS configuration files to point to our SMTP server. Login to your favorite shell program and navigate to the folder that your ghost installation lives on. Which for me was /var/www/foolish. You will then want to run nano config.production.json or nano config.development.json if you're still in development mode.

You will be presented with a lovely nano text editor!

Right below your database information you should see an empty "mail": { object. And in there, you will paste the following:

"mail": {
		"from": "'BenGarrison' <[email protected]>",
		"transport": "SMTP",
		"options": {
			"host": "smtp-relay.sendinblue.com",
			"port": 587,
			"service": "mail",
			"secure": false,
			"requireTLS": true,
			"auth": {
				"user": "YOUR-SENDINBLUE-LOGIN",
				"pass": "YOUR-MASTER-PASSWORD"
			}
		}
	},

After you pasted that into your config file you will hit Ctl+O to write-out the file. Enter to confirm you wish to save, and the Ctl+x to close nano.

Your final config file would look similar to this, with a few exceptions

{
	"url": "https://bengarrison.me",
	"server": {
		"port": 1234,
		"host": "127.0.0.1"
	},
	"database": {
		"client": "mysql",
		"connection": {
			"host": "localhost",
			"user": "db-user",
			"password": "db-password",
			"database": "db-database"
		}
	},
"mail": {
		"from": "'BenGarrison' <[email protected]>",
		"transport": "SMTP",
		"options": {
			"host": "smtp-relay.sendinblue.com",
			"port": 587,
			"service": "mail",
			"secure": false,
			"requireTLS": true,
			"auth": {
				"user": "SENDINBLUE-USER",
				"pass": "MASTER-PASSWORD"
			}
		}
	},
	"logging": {
		"transports": [
			"file",
			"stdout"
		]
	},
	"process": "systemd",
	"paths": {
		"contentPath": "/var/www/foolish/content"
	}

Then you just need to restart your Ghost instance by running ghost restart.

Testing

Testing is pretty straight forward and there are things I would do to make sure that emails run smoothly.

  • Add a staff member from the admin panel and ensure that the email is sent properly
  • Add a member manually in the admin panel and then attempt to login. It should generate a login email
  • Subscribe as a member to your site (or mine 😜), from the front-end and make sure that the user flow works properly.

What's next?

Having a self-hosted Ghost installation is a wonderful experience. It runs fast, it's super easy to make and publish content and has a wonderful look and feel. However, as with anything that is self-hosted, you have to manually configure certain aspects of the software. Sendinblue solves the problem of transactional emails very easily. And for that, I am grateful!

I think overall time commitment on this would be about an hour of your time. Maybe less if you're not as slow as I am. So now you can go out there and start creating content and working to get your first 10 users! Let me know when that happens, so we can celebrate together!

Thanks everyone, stay foolish!