Transcription
Hello? It’s Dave here. And in this video I’m going to configure a self hosted instance of Ghost to send out both transactional as well as bulk email. Alright, let’s get into it. First, I want to break this apart.
What are the different types of emails that Ghost can send? So here’s the login page to a Ghost console. And if I wanted to log in as the administrator, I could type in my email address right here. But if I forgot my password, I would click right here where it says forgot. But I haven’t set up transactional emails yet.
So I get this not very helpful error message that says copy error is not a function. So I won’t be able to reset my password until I’ve configured transactional emails. The same goes for members of your site that are trying to log in. If they can’t log in, it’s because you haven’t set up transactional emails. This is the login screen for the same website.
I’m going to go ahead and type in an email address here. Hit continue. And it’s just spinning and spinning. Nothing ever happens. Both of the emails that I just showed you are considered transactional emails, meaning that it’s one email going out to one recipient.
With Ghost, you can use any email provider. They give some popular examples. Here Amazon, Ses, Mailgun SendGrid and Gmail. And examples of these we’ve already seen a couple, but other examples would be staff user invites, member newsletter, sign, VPs, member account creation, and login links. But Ghosts can also send a different type of email known as bulk email, where you have one email going to many recipients at once.
The most obvious example here is sending email newsletters. Let me show you how that works in Ghost. So I’m in the post section over here inside of Ghost, and you’ll notice that there’s one post here called Coming Soon. This is the default post that comes up with every Ghost installation. If I click on it, you’ll see that the post is not published.
So I’m going to click on this green publish button and I’ve got some options. I can publish it, which will just put the post on my website like a normal blog post. But if I click here, I’ll reveal some other options. I can actually send it out as an email only and it won’t even be on my website. Or I can do both.
I can have it be published on my website and sent out as an email. Now these options are grayed out for me because I don’t have mail configured and I also don’t have any members on my website or subscribers to send them to. So our task for the rest of this video is going to be to configure both transactional emails as well as bulk emails. Now I’m going to be using Mailgun throughout this video simply because it’s the one service that works for both transactional as well as bulk emails. Right now you need to use Mailgun to send out bulk emails on Ghosts.
So why not use it for transactional emails as well? You still need to configure both services. So if you want to swap out a different one, you’re welcome to do that. Let’s talk a little bit about Mailgun pricing first because that’s a bit of a sore spot for some people. So here’s the Mailgun website.
They’re a very reputable sender, great deliverability, but the one thing that gets people is the pricing plans. They’re not very transparent until you really understand them. So here I am in the pricing section and you might be looking and say, oh, there’s a one month free trial and then I have to spend $35 a month. I’m not going to send 50,000 emails. This is too expensive for me.
And I’ve got good news that’s actually not the case. You can send the first 1000 emails every single month, absolutely for free. And after that they have a pay as you go program where they’re going to charge you one dollars for every additional 1000 emails. So if you’ve got a list of just two or 3000 people and you’re only emailing them a few times a month, you’re looking at four or $5 for email. So definitely reasonable.
Not as cheap as some other providers like Amazon, Ses, but definitely reasonable. This is a good time to point out that email sending is included with Ghost Pro. So if you’re still on the fence about whether or not you want to self host, well, Ghost Pro scales price wise the way it does because as you get more contacts, they assume you’re going to be sending more emails and it’s going to be an extra cost for them. So hopefully that helps you understand why it gets more expensive with Ghost Pro. All right, enough talk.
Let’s go ahead and configure this thing. It won’t take long now that you know what we’re doing. So I’m logged into my Mailgun account. I’m understanding then domains, and then I clicked on Add a new domain. You’ll see a screen that looks like this where you have to enter in your domain name.
Now you might be tempted to just type your plain domain name here, but Mailgun likes to use a subdomain. So in my case I’m going to use M Daveswift.com. All right, I’m going to choose the region I’m in the US. So that works well for me. I want to toggle on the advanced DKAM settings and I’m going to go with a longer DKM passphrase here or Key and hit Add Domain.
On the next screen. We’re given the DNS settings. These are essentially long strings of text that we have to copy and paste from Mailgun over to our DNS provider. I’m going to start off with the first one. That is my SPF record.
I’m going to copy this, add a new record. This is going to be a text record. I’ll type M for the domain name. You can see up here. Cluster does a really nice job of cluing you in on what you’re actually doing.
So right now it’s M Daveswift.com, which is exactly what I want, and I’ll go ahead and paste in that string from Mailgun. Hit save. All right, the next section down here is for our DKIM authentication. I’m going to go ahead and copy the value here. This will be another text record.
Hit add record. Choose the type to text, and I’ll paste in the value here. I’m going to jump back over to Mailgun and just grab in this prefix, paste it in, and I have to add in the M again. I kind of want to look up here to see that I have the matching prefix for my domain or the matching subdomain, and hit save. All right, next up, we’re going to configure some MX records.
Now, this is very important. You only want to do this if you’re using a sub domain. If you’re already using a different service like Gmail for receiving email on your primary domain, you don’t have a sub domain here. You’ll want to skip this step, but they actually recommend it for anyone using a subdomain, which is also the recommended overall situation. So what we’re going to do is go ahead and grab this MX record value right here, and I’m just going to look ahead and see that the next one is the same.
It just replaces the letter A with the letter B. It’ll stop me from bouncing back and forth so much. And I’ll go over to Cloudflare, add a record. This is going to be an MX record, and I will add in the M subdomain, paste in the mail server and give it a priority of ten. Then hit save.
And I’m going to do the same thing one more time. Give it an MX record, the name of M mail server. This time I’m going to change it over to B and the priority of ten again. All right, hit save. Almost done.
Just one more record to create. This is a C name record that’s going to be used for tracking Opens. So what we’re going to do is copy this, and I can see it’s just email M. So I’m going to go ahead and add that record. It’s a CNAME.
Turn the proxy off if you’re using Cloudflare, and hit save. All right, once you’ve got everything saved, go ahead and verify the DNS settings. This can take a little bit of time, so if everything doesn’t verify right away, don’t worry. But I think everything should go by pretty quick here. You can see the one SPF record has not validated yet.
That’s totally fine. I’ll try again in a moment. All right, upon refreshing, I get this screen right here that says no recent results. It would be better to get a confirmation message, but what they’re telling me here is that I’m ready to send. So that’s good news.
Back over to Ghost. We are going to configure bulk email sending first because honestly, it’s easier than transactional email. And I want you to get a quick win here. After the DNS stuff being a little bit boring, let’s go ahead and get this done. Click on the gear icon, go over to the newsletter section.
And then right here you see the Mailgun configuration. It says the Mailgun API is used for bulk email newsletter delivery. We’re going to expand this section. And right here you’re going to want to choose your region. You can see you have the choice between the US.
And the EU. Remember, I chose the US. When I was setting up my domain. Then I’m going to type in my domain here. Mine was m Dave Swift.com.
Then next you need to enter in your private API key. You can actually click right here and it will link you over to the right page inside of Mailgun. Now I want to show you a mistake that I have made in the past so that you don’t make the same mistake in Mailgun. You can actually get sending APIs. That’s not what we want.
So do not do this. Do not go into domain settings and then going to sending APIs and add a new API key. What this will do is let you send out emails, but it will not allow you to track the opens inside of Ghosts. You will not have analytics, definitely a little bit alarming when you send out an email and you get a 0% open rate. So if you find that that’s happening, this is the solution.
You’ve probably set up the wrong type of API key. What you really need to do is click on your user account and then go down to API keys right here. The API key that we want for Ghost is this one right here. Unfortunately, there’s not an easy way to copy and paste it. You actually have to click the little I over here to reveal it, then copy and paste it in Ghost.
So I’m going to do that right now, but obviously I’m not going to show it to you. All right, back over in Ghost, I just pasted in my API key. I’m going to go ahead and hit Save. And we’re almost done with our bulk email settings. But there is one more thing we want to do.
Jump back over over to Mailgun and go over to domain settings here. And you’re going to want to look for the tracking section. By default, this is set to be off. You’re going to want to turn these all on. So you do click Tracking, open tracking and unsubscribes.
Hit Edit, turn it on. Hit Edit. Turn it on. All right. So now Mailgun is going to be tracking your opens and clicks and it will report to Ghost via the API integration.
All right, we are halfway home. Our bulk email is configured. Now we need to set up our transactional email. We’re already in the right spot inside of Mailgun, inside of domain settings under Sending. So once again, sending domain settings.
And then we’re going to click on SMTP credentials. Remember, transactional email goes out via SMTP, which is kind of a normal username and password scenario versus the bulk emails, which went out over API and just used a single string as our API key. So a different configuration altogether here. We’re going to hit add new SMTP user, give it a name here I like to use something like no Reply. Keeping in mind that these emails are going to be password resets and things like that.
So you’re not necessarily going to be checking these emails. Then we’ll create the credential, and over here in the right hand corner, we can click to copy the password. Now the next step is to add the login credentials to a file on our server. Unfortunately, there’s not easy access via the GUI like there was for bulk email. So I’m going to link to this document over on the Ghost documentation page, which is going to give us a bit of a template that we can follow here.
So you can see this is what we need to just update with our username and password. So I just pulled open a text editor here, and first things first, I’m going to paste that SMTP password that I just copied from Mailgun. Then I’m going to go back over to the documentation here and grab all of the code right here, copy this. And then I’m going to put it inside of my text editor, grab this password one more time, and replace the password that they provide to us, which is obviously not a real password. And then for the username, I’m just going to write my email address that I set up as my SMTP login, which was Noreply@mprofitabletools.com.
So what I need to do now is copy all of this text and then I need to go ahead and connect to my server via SSH. So let’s open up our terminal just like we did in the installation video. And assuming the last thing you did was connect to your server in the installation, you can simply press the up arrow key and you’ll see the command still there. But if you don’t have that, you can log back into your digital Ocean account, grab the IP address, and then you’re simply going to type in SSH root at and then the IP address. Okay, so I’m logged in now, but remember, before I change anything on Ghost, I’m going to have to switch users and they’ve got the command here for me.
That’s really nice and convenient. I’m glad they did that. So I’m going to copy this and paste it into the command line that’s going to switch me over to that Ghost Manager user and I can see before I was en route. And now I’m on Ghost Manager. So next I’m going to navigate to where Ghost was installed, which in this case is going to be typing CD to change the directory, leave a space, and then I’m going to do varwghost.
All right, now I’m in the Ghost directory. I can type LS and it will show me all of the files and also confirm that I’m in the right spot. And what we need to do is edit this config production JSON file. And to do that, I’m going to type in nanospace config production JSON, hit Return. And these are the settings for my Ghost configuration.
You can see there is already a block down here for mail. I can get rid of this because I’m going to replace it. I’m going to press CTRL K. That will remove that line. I’ll press it one more time, get rid of it again, and then get rid of that closing bracket as well.
All right, I’m going to do a line return here to open up a space, go back over to my text documents, grab the code, paste it in, and then I should be able to exit out and save. To exit. I’m going to press CTRL X Y to save and then hit return. Now we need to go ahead and restart Ghost by typing Ghost. Restart should see a little message that Ghost successfully restarts.
If you get an error message here, you’ve done something wrong in the JSON file. Probably a comma here or there. So just go back and make sure there’s not an extra comma or that you didn’t forget to add a curly bracket somewhere. Just make sure everything is exactly as it is in the template. Thankfully, Ghost restarted successfully for me, so no problems there.
Let’s go ahead and confirm that our email sending is actually working. Now the first thing that I’ll do is try that password reset like we saw at the beginning of the video. I’ll hit forgot and sure enough, we get a message up here at the top that says to check your email for instructions. And here I am inside of Gmail. The message was delivered successfully.
All right, so our transactional email is working. All that’s left to do is confirm that our bulk email is sending as well. So I’m going to send out a test email. I’ve got this draft post here that we looked at earlier. I’m going to go to the sidebar and I’m going to go ahead and go to the email newsletter section and send out a test email.
This will use the API connection to send things out and we can confirm that email is sending properly back over to Gmail. Here is my coming soon email. Everything sent successfully. So we have configured email properly on Ghost. All right, we are all set.
You can feel accomplished in that you have set up bulk email as well as transactional email to send successfully from your self hosted ghost instance. Man, that’s a mouthful. I hope this video has been helpful to you. Thank you for watching. Let me know if there are any questions.
I’d be glad to help you out and I’ll see you in the next video.