Sending Newsletters with Ghost and Mailgun: A Beginner's Guide

In this post, I’ll introduce how I integrated Mailgun into my Ghost blog server for sending newsletters.
Why Mailgun?
Ghost is strict about bulk mailing:
- Mailgun is the only officially supported service for sending newsletters.
- If you're using something like Gmail SMTP, it can only handle small, transactional emails (like signup confirmations)—not bulk newsletters.
If you want to send beautiful posts as newsletters to your subscribers, Mailgun is your best (and officially supported) option.
Mailgun Basics
Setting up Mailgun is fairly easy, but not very intuitive at first. I’m no mail server expert, but after a few Google searches, I was able to set it up.
Mailgun's free plan gives you up to 3000 emails per month—more than enough for hobby bloggers!
Setting Up Mailgun with Ghost
1. Create a Mailgun Account
- Go to mailgun.com and sign up.
2. Add Your Sending Domain
- Add a subdomain like
mail.christeena.dev
(you don't want to use your root domain).
3. Add DNS Records
- After adding the domain, Mailgun will show you DNS records.
- Copy those and add them to your DNS provider (e.g., Cloudflare).
- TXT records for domain verification
- MX records for routing mail
- CNAME if needed for tracking
4. Get Your SMTP Credentials
- In your Mailgun dashboard, go to SMTP Credentials.
- Reset the password to get your initial password.
5. Update Ghost config.production.json
Here's the snippet you need to add:
"mail": {
"from": "noreply@<mail.yourdomain.dev>"
"transport": "SMTP",
"options": {
"service": "Mailgun",
"host": "smtp.mailgun.org", # If your mailgun region is not US, look for the host on mailgun console
"port": 465,
"auth": {
"user": "noreply@<mail.yourdomain.dev>",
"pass": "your-smtp-password"
}
}
}
The config json should include other configs to be valid, like url, server, database configuration. Those are the configs for your ghost server that you normally provide in docker compose file or .env file.
After editing the config, restart your Ghost server:
docker compose restart ghost
6. Set Up Mailgun API in Ghost Admin
- Go to your Mailgun dashboard, find API Security Settings under account settings.
- Generate a new Private API Key.
- In your Ghost Admin panel:
- Navigate to Settings > Email Newsletter
- Enter your:
- Region (US/EU)
- Mailgun API Key
- Mailgun sending domain (
mail.christeena.dev
)
7. Test Sending
- Create a new post.
- Click "Preview" > "Email preview".
- Send to a test email account to verify if everything works.
Troubleshooting Tips
If emails fail to send, you can debug using Docker:
cd /your/blog/server/directory
docker compose logs ghost -f
This will show live logs while you test.
If you encounter errors, go through all the steps one by one, check typos and credentials and then trying to restart the service may solve the problem half the time.
Besides that, I would also suggest googling for different post about the topic, or include the error message when searching.
Just remember, even if this is your first time trying out these settings, any errors you encounter are mostly solved by others before. So it is not that hard to find the right answer when going down the rabbit hole.
Conclusion
While it looks a bit technical at first, setting up Mailgun with Ghost is very doable even for beginners. Once configured, you’ll have a full newsletter system running for free under 3000 emails per month—a perfect and professional looking setup for a personal blog!