How to enable E-Mail Signups on Self Hosted Ghost-CMS

How to enable E-Mail Signups on Self Hosted Ghost-CMS

I installed Ghost CMS on a Digital Ocean Droplet using the (probably not yet famous) One-Click-Installation. Using this method, my blog was up and running in minutes. However, I quickly realised something was off, because no users could sign up and no emails were sent.

Tutorial

What they don't tell you in the documentation is, that you need to configure your web-server (not only Mailgun), in order to be able to sign up new subscribers and send emails.

First, verify your Domain with Mailgun

  1. Sign up for a Mailgun account: Go to https://www.mailgun.com/ and sign up for a (free?) account if you don't have one already.
  2. Add and verify your domain: Follow the linked guide below to configure Mailgun for your domain. This process requires adding DNS records to your domain registrar.
Setup ghost to send out newsletter emails with Mailgun
There are two types of emails in ghost. Transactional emails & Newsletter orBulk emails. Transactional emails are mainly used for Sending the admin invite,Sign in/Sign up emails, etc. We have a blog post SMTP Setup to send outtransactional emails. Configure SMTP For Outbound Emails (Ghost SMTP S…

Verified? Let's go!

  1. Don't skip the last step of the guide above, and add your Mailgun configuration in your Ghost Admin. Go to:

Settings --> Members --> E-mail Newsletter

It should look something like this:

Settings --> Members --> E-mail Newsletter
đź’ˇ
Make sure that you added the Sending API Key, instead of the Private API Key in the bottom field.

2. Obtain SMTP credentials: Once you made sure that your domain is verified, go to the Mailgun dashboard, click on your domain, and note down the following information:

  • SMTP Hostname (e.g., smtp.eu.mailgun.org) (1)
  • Default SMTP Login (e.g., postmaster@yourdomain.com) (2)
  • Default Password (press the Reset password button to show) (3)

4. Access your Ghost CMS configuration file: SSH into your Digital Ocean droplet (or other server) using a terminal or an SSH client like PuTTY. The command should look like this:

ssh root@your_droplet_ip

5. Locate the Ghost CMS configuration file: The configuration file is usually named config.production.json and is located in the Ghost installation directory. By default, it should be in /var/www/ghost. Change to that directory using the following command:

cd /var/www/ghost

6. Edit the configuration file: Open the config.production.json file using a text editor like nano:

nano config.production.json

Locate the mail section in the JSON file. It should look like this:

"mail": {
  "transport": "Direct"
},

7. Update the mail configuration: Replace the existing mail section with the following, making sure to replace the placeholders with your actual Mailgun SMTP credentials:

"mail": {
  "transport": "SMTP",
  "options": {
    "service": "Mailgun",
    "host": "your_smtp_hostname",
    "port": 587,
    "secureConnection": false,
    "auth": {
      "user": "your_smtp_login",
      "pass": "your_smtp_password"
    }
  }
},

Save and exit the editor: To do so, press CTRL + X, then Y, and finally Enter to save the changes and exit nano.

8. Restart Ghost CMS: To apply the changes, restart Ghost using the following command:

ghost restart

10. Test email sending: To test if emails are sent correctly, sign up as a new user with your second E-Mail address.


You don't have to pay $35 a month for Mailgun

Read my blog post on how to downgrade to Mailgun's (very well) hidden pay-as-you-go plan:

How to Downgrade to the Flex Plan in Mailgun in 2023
Don’t want to pay $35 for sending out a few dozen emails a month? Me neither! Follow this step by step guide to downgrade to Mailgun’s (very well) hidden Pay-As-You-Go plan.

Like what you see?