Overview
Our aim with this step-by-step guide will walk you through how to add and verify a domain in Mailgun.
Verifying your domain is an essential step to start sending email through Mailgun. We ask all of our users to verify ownership to enable open and click tracking, mitigate spam, and ensure that nobody can send from your domain besides you and your organization.
If your domain is already hosted somewhere, you’ll need to login to your provider to change DNS records. If your domain isn’t hosted anywhere yet, you can setup an account at a provider like Cloudflare, Google Domains, GoDaddy, or Namecheap.
Pro-Tip: We have guides specifically crafted for some of the most popular DNS hosting providers below in Step 2.
Step 1: Add your domain to Mailgun
If you’ve already added your domain, skip to step 2.
Prefer videos? This video walkthrough demonstrates adding a domain to Mailgun's system and configuring that domain's DNS records within a DNS hosting provider.
Before you can verify a domain, it needs to be added to Mailgun. We'll guide you using the steps below:
- First, log in to the Mailgun Control Panel (if you have not already done so)
- Then, within the left-hand navigation pane, click the Sending option to expand its list of suboptions.
- Next, click the Domains suboption.
- To add a domain, click the Add New Domain button.
- Fill in the required information and click the Add Domain button.
As for choosing a domain, we recommend using a subdomain for better email deliverability. In this example, we used mail.yourdomain.com. If you want to use just your domain name, that’s (usually) fine too.
The next screen that you're taken to will ask you to add DNS records to your domain. Leave this screen open for the next step.
Step 2: Add DNS records to hosting provider
Use one of the available guides if your DNS provider is listed below.
Next, you’ll be asked what type of DNS records you want to add. We’ll go through each one individually below so that you have a general idea of how to add these to your DNS hosting provider. Please note, the below are examples using just one DNS provider; as such, there will be some differences for how you will enter your DNS records into your DNS host.
TXT records
The first records Mailgun asks you to add are TXT records. We will add two separate TXT records, one for SPF and one for DKIM. These are required to send and receive email with Mailgun.
Note:
If you already have an existing SPF record for this root domain, you cannot add another SPF record.
Instead, you will insert the value include:mailgun.org
into your existing SPF record. Ensure this value is placed somewhere after v=spf1
and somewhere before ~all
. Also, ensure this value has one space character to its left and one space character to its right.
For example, v=spf1 include:domain1.com include:mailgun.org include:domain3.com ~all
If you’re using a subdomain, add a new TXT record with mail.yourdomain.com as the hostname (with certain providers, you may just have to enter the subdomain, which would just be mail in this case) and the appropriate value Mailgun provides. You can leave TTL as the default option.
If you’re not using a subdomain, most providers will accept @ as the hostname when creating DNS records for the root domain. Here’s an example:
Clicking Add Record will add your first DNS entry for your domain!
Add another TXT record for mx._domainkey.mail.yourdomain.com. Cloudflare only shows the subdomain, so your result will look like this:
MX records
Next, you need to add MX records. Mailgun requires you to add two separate MX records.
You will add the MX records the same way you did with the TXT records. The hostname in this case is mail.yourdomain.com You’ll also be asked for priority, which should be 10.
CNAME record
Lastly, you will need to add a CNAME record. The CNAME Record is what enables Open and Click tracking. This is highly recommended to reap the full benefit of Mailgun and gain insights into your email performance.
Add the CNAME the same way as the others. The hostname here is email.mail.yourdomain.com
Step 3: Wait (up to 24-48 hours)
It can take up to 24 to 48 hours for DNS changes to propagate across the internet. In our experience, it usually happens faster than that, but don’t get discouraged if it doesn’t happen immediately. If everything is setup right you’ll receive an email from Mailgun like this:
If you’re impatient like us, you can also use the ‘Check DNS Records Now’ button on the DNS Settings page.
For additional troubleshooting scenarios and tips should you need them, please refer to this article.
Need Support?
Our Support Team here at Sinch Mailgun is happy to help! Reach out to us in the Support page of your Mailgun Control Panel, and we'll be with you shortly!