How to configure Ghost using Mailgun for sending emails (newsletter and membership)
The short story. Ghost needs two core configuration to send emails correctly:
- 1) API key
- 2) SMTP credentials
The long story. There are two types of emails configurations in Ghost (since v3 and above):
- The "API key" configuration is required for the "mailing list" email service. It's used to email posts to your members.
- The "SMTP" configuration is required for transactional email service: subscription confirmations, secure login links and emails to Staff Users.
How FirePress sets up your email configuration depends on the way your domain is managed by FirePress. Under Option A and B as detailed here, we manage your DNS settings, we also manage your email services. If you are under option A or B, you only have to worry about entering your API key into the Ghost Admin.
In the video, I will teach you how to:
- Create a new domain in Mailgun
- Find your DNS record (TXT, MX, CNAME)
- Configure your DNS record depending on how your domain is managed
- Find your
- Find your
Create your credentials
You must create a Mailgun account.
In the video, you can see how to configure the
API key yourself in the Ghost Admin Panel. That's the easy part.
Where to enter your API key? Admin panel => Settings Email newsletter => Mailgun API key => X0X00X-X0X0X0X0X0X0XX0X0X0X-X0X0X0X0
When FirePress runs your Ghost site, Ghost looks for a configuration file named
config.production.json. This file is not available from the Ghost Admin Panel but only from the actual server. In other words, FirePress manages this for you. Pay attention to lines 14 - 20 - 21 in this screenshot below:
If you choose Option C as detailed here « How can I configure my domain or DNS to FirePress servers » you must send us these
from: Acme Team <[email protected]> host: smtp.mailgun.org user: [email protected] pass: 98rstns9r8tnchangeme8t1ns9r8-aergaer-aergaerg
Can I use my own SMTP server?
Yes. Configuration settings (SMTP credentials) are for transactional emails. We are not limited to Mailgun as provider for this.
Keep in mind that transactional emails via (API key) are for: Staff invites, Member signup, signin, etc. The Mailgun settings in the UI are for sending bulk email newsletters to members, only Mailgun is supported for that. Source.
v=spf1 TXT record. You might have other email providers like Gmail, Zoho, Protonmail, Sendgrid, etc. using this
v=spf1. They must be all under the same
v=spf1 TXT record. See the video for details.
You cannot have MX from two providers! Unless you already have MX records for pointing to another email provider (e.g. Gmail), you should update the following records.
v=spf1 include:_spf.google.com include:mailgun.org ~all