In this tutorial I want to share the main options on how to set up mail on your Ghost blog.
I'll cover both Mailgun setup (recommended by Ghost) and free alternatives as well.
If you skip mail configuration, you won't be able to receive any emails from your blog, Ghost in-built subscribe and newsletter functionality won't work and you even won't be able to reset your password via email.
For this tutorial, I assume, that you've installed Ghost using the method I shared in my previous blog post. Which means that Ghost blog was installed using docker via Cyberpanel on Google Cloud instance.
Contents:
- How Ghost mail system works
- Option 1: 3rd party newsletter, disabled Ghost mail
- Option 2: 3rd party newsletter, free 3rd party SMTP service for Ghost transactional emails
- Option 3: use Mailgun for in-built Ghost newsletter functionality and transactional emails
- Be careful with Mailgun
Video version
How Ghost mail system works
Thing is, Ghost is a bit tricky in terms of sending emails. There are two types of emails sent by Ghost: transactional and newsletter. The first one is for password resets, member signups and staff user invites. The second one is used exclusively for sending out newsletters.
Problem is, Ghost only allows Mailgun service to send newsletters, which is only free for 3 months and 5000 emails each month. After that — it's still free to send up to 500 emails each month, but that's a tiny amount. Compare that to Sendinblue free 9000 emails and Sendpulse free 15000 emails per month.
Options on how to set up mail on your blog
So there are 3 main options you can go for when setting up mail on your ghost blog:
- use free 3rd party service for the newsletter, disable Ghost mail completely;
- use free 3rd party service for the newsletter, use free 3rd party SMTP service for Ghost transactional emails;
- use Mailgun for in-built Ghost newsletter functionality and transactional emails.
And, of course, you can just disable all the mail functionality and quit creating newsletters — that might be a wise decision if you want to focus on creating content for your blog. But having a list of active subscribers at some point in future is 100% worth it.
Why you should avoid sending transactional emails via your server
Technically Ghost allows you to send transactional emails using your server if it has mail functionality turned on (SMTP port 25 opened). But most of the servers out there come with port 25 blocked for a reason.
- It's harder to configure your own server to correctly send mail
- It's much easier for your server to be compromised
- And overall it's much easier for your emails to end up in spam. And we don't want that.
Option 1: 3rd party newsletter, disabled Ghost mail
The easiest option is to completely ignore Ghost mail setup and use 3rd party newsletter service by simply embedding their html signup forms into your blog posts or website pages. Some services like Mailchimp or Sendpulse allow you to create beautiful popup and floating subscription forms.
By the way, in one of the future videos on my YouTube channel I will be showing in detail how to add 3rd party free subscription forms and newsletters to your Ghost blog — so consider subscribing to stay tuned for that.
The main downside of sticking to option #1 is that if you forget your admin's password there won't be an option to simply reset it via email. You will have to mess with changing the password in the database, which is a real headache.
Either keep your password safe or consider moving to option 2.
Option 2: 3rd party newsletter, free 3rd party SMTP service for Ghost transactional emails
Let's set up transactional emails with Sendinblue, which is free up to 9000 emails per month.
Create a free account, head to Your Account — Senders and IP — Domains.
Add a new domain (check I would like to use this domain name to digitally sign my emails).
After that, copy DNS records one by one and paste them into your domain DNS.
If you use Cloudflare for managing your domain, go to Cloudflare Dashboard, select your domain and click on DNS in the menu on the left.
When you're done copying the records — press "RECORD ADDED. PLEASE VERIFY IT" buttons back at Sendinblue.
By the way, it might take up to a day for your records to update. You can check if your records are updated by visiting dnschecker.org (free tool).
Now your domain should be shown as "Authenticated".
Switch to SMTP & API section in the main menu and create a new SMTP key. Save it for later.
SENDINBLUE EMAIL CONFIG
Log into your Google cloud console, head to VM instances and SSH into your server. After that copy/paste the following commands to edit config file with admin privileges:
sudo su -
nano /etc/postfix/main.cf
Scroll to the bottom of the configuration and paste this:
relayhost = [smtp-relay.sendinblue.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
After that use the following command to create a file with your mail credentials.
nano /etc/postfix/sasl_passwd
Put your OWN credentials into the file following this formatting:
[smtp-relay.sendinblue.com]:587 your email:Sendinblue-SMTP-key
Next copy-paste these commands to encrypt the password, change permissions, and restart mail service:
postmap /etc/postfix/sasl_passwd
chown root:postfix /etc/postfix/sasl_passwd*
chmod 640 /etc/postfix/sasl_passwd*
systemctl restart postfix && systemctl enable postfix
Another benefit is that people can now subscribe using default ghost subscribe buttons, and you will be able to synchronize those subscribers with your newsletter either manually or through Zapier, but you won't be able to send them newsletters via Ghost.
If you want that — look at option 3.
Option 3: use Mailgun for in-built Ghost newsletter functionality and transactional emails
Create a Mailgun account After your account is verified add your domain and set up your DNS settings. Navigate to Sending ➡️ Domain Settings ➡️ DNS records. Copy and paste all records to your domain DNS.
Now head to Domain settings under Sending in the Mailgun admin. There you’ll find your SMTP credentials. In addition to this information, you’ll need a password, which can be obtained by clicking the Reset Password button. Keep these details for future reference.
Cyberpanel Mailgun config
Now we'll need to edit our docker variables. Open Cyberpanel, navigate to Docker Manager - Manage Containers. Select your container and navigate to Settings. Make sure ENV editing box is checked. Add the following parameters:
mail__transport SMTP
mail__options__service "Mailgun"
mail__options__port 587
mail__options__auth__user "mailgun-username"
mail__options__auth__pass "mailgun-password"
mail__options__host "smtp.mailgun.org"
Finish the Mailgun setup by going to your Ghost admin panel and then to Settings ➡️ Email newsletter ➡️ Mailgun configuration.
Enter your domain and region.
Add your API key, which you can find by clicking on the link right below the text field.
Now it's time to check if mail config works fine. Subscribe yourself to a blog using the corresponding button on any blog page. If you've received a confirmation mail to your inbox — then transactional mail works as intended. Make sure you've confirmed a subscription.
Let's test newsletter functionality. Create a post, make it a send only post and send it out. If an email with this post hits your inbox — then everything is configured right and I congratulate you on completing the setup.
Be careful with Mailgun
Malgun provides a free one month trial with 5000 emails sent (in fact, up to 6000 — more on that in a moment). If you opt to enter your credit card during sign-up, you’ll enter a one-month trial in which your card will not be charged unless you exceed the limit.
After your trial expires, you will be charged 35$ per month. Mailgun has a pay-as-you-go Flex plan with 1$ per 1000 emails price. And if you send less than 1000 emails per month you don't get charged, as Mailgun has a 1$ minimum for payment processing. And that's the reason why you can send up to 6000 emails and not 5000 for free during your trial month.
But - once again - you will have to manually switch to Flex plan before your trial period ends or you will be charged 35$ per month. And once you change trial plan to Flex you'll have 1000 free emails per month limit and not 6000.
So the cheapest way here is to stick with free trial almost until it ends and switch to Flex pay-as-you-go before trial period runs out.
While Mailgun provides the best integration with Ghost if you're on a budget and plan on sending many emails — consider 3rd party newsletters, as those will be either free or significantly cheaper. I'll talk more about how to integrate those into your Ghost blog in the nearest future, so consider subscribing to my YouTube channel not to miss that.