Creating your Newsletter with Ghost

Mar 20, 2021

Dear friend,

I'm running my Ghost blog & newsletter using my own SaaS named Upblogr. Upblogr is a managed hosting service that makes it easy for you to create a Ghost site automatically in literally 5 minutes ๐Ÿš€

Ghost 4.0 was launched on the 16th of March and I recently upgraded my blog to this latest version. Some important features related to email newsletters that come with Ghost 4.0 are:

  • Memberships and subscriptions are now natively part of the core platform - no longer in beta. Publishers who started sites with Ghost last year are now making more than $2Million per year in revenue from the platform.
  • Email newsletters are now natively built into Ghost.

As you can see, Ghost is making newsletters a first-citizen in their platform and lots of publishers are seeing their earnings increased as they build a big audience.

As a person eager to look into the latest features of any product, I couldn't wait to try out the newsletter feature. So, if you feel the same and have a self-hosted Ghost blog (or use Upblogr to create one), I'd like to show you how to configure email newsletters ๐Ÿ“ฉ

What do I need to create a newsletter with Ghost?

To deliver your publications to members by email, you need a bulk email delivery service for you. Good news is, Ghost comes with bulk mail API support for Mailgun.

Using SMTP mail config to send emails newsletters with Ghost is neither recommended nor supported. This is because your IP address will end up being blacklisted and marked as spam by all mail providers, and that's the last thing you want to happen when you create a newsletter ๐Ÿ˜‰

To learn more about it, check out the official FAQs from Ghost:

Why do I have to set up Mailgun for newsletters?
Sending bulk email to many recipients using SMTP is not supported. In order to send newsletters from Ghost youโ€™ll need to setup Bulk Mail with Mailgun.
Why do I have to set up Mailgun for newsletters?

Create a Mailgun account

Sign up in Mailgun to create a new account. You can start for free (5000 free emails per month for 3 months, then only pay for what you send) or use any other plan available in their pricing page.

Once you've created your account, remember to activate it (otherwise Ghost will fail to send emails).

Create a Mailgun domain

A Mailgun domain is fundamental to send emails from your Mailgun account - it's actually where you're sending from!

In my case, I created a new Mailgun domain in the EU region under my main domain felipecruz.es. For instance, mg.felipecruz.es or mail.felipecruz.es could be valid Mailgun domains.

Mailgun domain

Set up DNS records

After creating the Mailgun domain, you will be redirected to a list of DNS records that you need to configure.

TXT records (known as SPF & DKIM) are required to send and receive email with Mailgun.

  • MX records are recommended for all domains, even if you are only sending messages.
  • The CNAME record is necessary for tracking opens, clicks, and unsubscribes.
Mailgun DNS records

As I'm using AWS, I have a Route 53 named felipecruz.es where I have added the DNS records that Mailgun displayed in the set up page.

Route 53 DNS records

Configure the Email Newsletter settings in Ghost

In your Ghost site, under Settings > Email newsletter, there is a section where you need to set the Mailgun region, domain and API key.

Find your Mailgun region and domain here ยป

Find your Mailgun API keys here ยป

Email newsletter settings

After setting the properties aforementioned, make sure you save the settings.

Add the Mailgun settings in the Ghost container

If you happen to host your own Ghost blog running as a container, then you need to add the Mailgun settings as environment variables in the Ghost container.

In my case, I have my Ghost blog running as a container in Kubernetes. I had to update the Deployment YAML specification to include the following pre-fixed mail__ environment variables. Remember to replace those with your own values:

... ommited lines ...
    
    spec:
      containers:
      - env:
        - name: mail__transport
          value: SMTP
        - name: mail__from
          value: <Foo foo@bar.com>
        - name: mail__options__service
          value: SMTP
        - name: mail__options__host
          value: smtp.eu.mailgun.org
        - name: mail__options__port
          value: "587"
        - name: mail__options__auth__user
          value: postmaster@<YOUR_MAILGUN_DOMAIN>
        - name: mail__options__auth__pass
          value: <YOUR_MAILGUN_PASS>
        image: ghost:latest
        imagePullPolicy: Always
        name: ghost
        
... ommited lines ...

Finally, you can try out if the email newsletter functionality has been set up correctly in Ghost. Go to your Ghost site and subscribe any email address by clicking on the Subscribe button:

Then, if everything was set-up correctly, you should see the following pop-up:

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ Thank you for reading, I hope this will be helpful for you and If you have any questions, reach out to me on Twitter!

Felipe Cruz

Software Engineer @docker ๐Ÿณ Building tools that help devs work on code as a team. CKAD. I enjoy writing about Docker, Kubernetes, and Golang.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.