Domains
Table of Contents
Overview
When emails are sent, they are transmitted through domains over the internet. An email address has two main parts: the username and the domain (e.g., username@example.com). Domains have a crucial role, as they are responsible for identification, routing and deliverability of email. Also, within Mailgun many features such as webhooks, logs, mailing lists and suppressions are associated with individual Domains.
There are two types of Domains to be aware of when working within Mailgun:
Sandbox Domain
Want to immediately test sending an email from your account without setting up and validating your own Domain?
Each new Mailgun account is automatically provisioned with a sandbox domain, sandbox <uniq-alpha-numeric-string\>@mailgun.org
. This is for testing purposes only. Sandbox domains can only send to authorized recipients.
Your Sandbox Domain allows:
- Sending messages to lists with up to 5 authorized participants
- Receiving Messages (limited to one Route)
- Tracking Messages
Sending limitations are also in effect for Routes that are triggered by message addresses to the sandbox domain and mailing lists created under that domain.
To use your Sandbox Domain:
- Log in to your Mailgun Control Panel
- On the left side control panel, click 'Send' then click 'Domains'
- Click on your Sandbox Domain link to go to the Overview page
- On the Overview page, select API or SMTP to see quick instructions on how to send
Custom Domains
Creating custom domains in Mailgun enables you to send emails through your own domain instead of relying on the default sandbox domain. To use Mailgun for production, you must create and verify your custom domain(s) with Mailgun to ensure proper authentication and deliverability. Once you've acquired a domain through a DNS provider, follow these steps to set it up with Mailgun.
Add your domain:
To create a custom domain, you can either use the Mailgun API or the Mailgun Control Panel.
If you want to add your domain through the Mailgun Control Panel, follow these steps:
- Go to the Mailgun Control Panel
- On the left side control panel, click 'Send' then click 'Domains'
- Click the Add new domain button from the upper right corner. Follow the instructions to add your domain.
Once a domain has been added, you will receive an email that you will need to respond to so that it can be verified.
Domain Verification
Five reasons why you need to verify your domain:
- To prove you are an authorized sender for the domain
- Verified domains are not subject to a sending limit of 300 emails per day
- No more "sent via Mailgun.org" message in your emails
- Establishes a positive email reputation for your own domain
- Mailgun is less suspicious of traffic that is being sent on verified domains and that reduces the likelihood of being disabled
The basic steps to verify a domain are:
- Get the DNS records (Via API or Control Panel)
- Open your DNS provider and add the provided DNS records:
Type | Required | Purpose | Value |
---|---|---|---|
TXT | ✅ | SPF (Sender Policy Framework): Sending server IP validation. This is used by most email providers. | v=spf1 include:mailgun.org ~all |
TXT | ✅ | DKIM (DomainKeys Identified Email): Like SPF, but uses cryptographic validation. | Find this record in the "Domain Verification & DNS" section of the Mailgun control panel for your domain. |
CNAME | ✅ | Required for Mailgun to track clicks, opens, and unsubscribes. | mailgun.org |
MX | ✅ | Required for Mailgun to receive and route/store messages addressed to the domain. | 10 mxa.mailgun.org 10 mxb.mailgun.org |
Once you've added the supplied records, and they've propagated over the internet (can take 24-48 hours for DNS changes to fully propagate), your domain is now able to be verified.
- You can either wait for Mailgun's system to check the domain and automatically verify it for you, or if you don't want to wait you can click 'Verify DNS settings' in the 'Domain Settings' section of the Control Panel, or call the Verify API
Verified domains will show up on the Mailgun Control Panel with a green Verified badge next to it!
For more information and help related to verifying domains check out these articles:
Common DNS Providers Documentation
If you'd like more detailed instructions on how to add DNS records for your domain, please refer to the documentation provided by your DNS provider. Below is a list of common DNS providers and links to their documentation:
Provider | Link to Documentation |
---|---|
Go Daddy | MX |
NameCheap | All Records |
Network Solutions | MX CNAME TXT |
Rackspace Email & Apps | All Records |
Rackspace Cloud DNS | Developers Guide |
Amazon Route 53 | Developer Guide |