Setting Up Mailgun in Your Ghost CMS Blog for Efficient Email Management

Cover Image for Setting Up Mailgun in Your Ghost CMS Blog for Efficient Email Management
Majid Ali Khan
Majid Ali Khan

25-06-2024

Introduction:

In this technical blog post, I will walk you through the process of integrating Mailgun into your Ghost CMS blog for effective email management. By following these step-by-step instructions, you'll be able to harness the power of Mailgun's email infrastructure within your Ghost CMS setup.

Step 1: Adding Your Domain in Mailgun

To begin, log in to your Mailgun account and add your domain. Mailgun will provide you with four records to add to your domain's DNS settings: two TXT records, two MX records, and a CNAME record. It's crucial to complete this step accurately.

Step 2: Verifying DNS Settings

After adding the DNS records, Mailgun needs to verify them, which may take 24-48 hours. During this time, ensure that the DNS changes propagate properly.

Step 3: Configuring Mailgun in Ghost CMS

Once your domain is verified, navigate to your Ghost CMS dashboard. In the Mailgun configuration settings, enter your Mailgun domain and private API key.

Step 4: Adding a New SMTP User

In order to send emails, we need to create a new SMTP user in Mailgun. For example, let's create the user hello@majidalykhan.com. Mailgun will generate a password for this user. Make sure to securely copy this password for the next step.

Step 5: Modifying the Ghost CMS Configuration File

Open your production.config file, located in the Ghost CLI directory (/var/www/ghost/). Locate the "mail" field and remove the default configuration. Replace it with the following code, substituting the appropriate values:


"mail": { 
"transport": "SMTP", 
"options": { 
"service": "Mailgun", 
"auth": { 
"user": "hello@user.com", 
"pass": "password" 
} 
} 
}

Step 6: Restarting the Ghost Server

Save the changes to the production.config file and restart your Ghost server. This will ensure that the new Mailgun configuration takes effect.

Conclusion:

Congratulations! You have successfully integrated Mailgun into your Ghost CMS blog for email management. Now, your blog can benefit from Mailgun's reliable email infrastructure. Enjoy the improved email delivery and take full advantage of Mailgun's features to enhance your blogging experience.

#ghostCms#mailgun
Majid Ali Khan
Open for Remote Work