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.
This step-by-step guide will walk you through how to add and verify a domain in Mailgun. For this example, Cloudflare will be used as the website hosting provider. However, it should be noted that these steps are the same for other hosting providers as well.
If your domain is already hosted somewhere (like Cloudflare), you’ll need to login to your provider to change DNS records. If your domain isn’t hosted anywhere yet, you can setup a free account at Cloudflare and follow along this guide.
Step 1: Add your domain to Mailgun
If you’ve already added your domain, skip to step 2
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
Login to your hosting provider and navigate to the DNS section. This area is called ‘DNS’ at Cloudflare, but we’ve seen it called ‘Networking’ in Digital Ocean and ‘Zone Editor’ in cPanel.
Next, you’ll be asked what type of DNS records you want to add. We’ll go through each one individually.
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.
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:
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.
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 hours)
It can take up to 24 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.
Mailgun by Sinch has answers! If you have any concerns or questions, please send us a Support ticket using the Support page within your Mailgun Control Panel. Our Support Team will be happy to assist!