Mailgun DNS records on DigitalOcean
August 13, 2016 • ☕️ 2 min read
After adding your domain on Mailgun, you need to add DNS records on your DNS provider, in this case, DigitalOcean.
Mailgun recommends using a subdomain for sending mail with Mailgun. In my case the domain is mikkohaapanen.com and the subdomain I’ll add to Mailgun is mg.mikkohaapanen.com.
These instructions show the steps to add the subdomain records on DigitalOcean, but the steps are very similar if you choose not to use a subdomain for email.
Add New Domain on Mailgun
After adding the domain on Mailgun, you should see a page like this:
Adding DNS Records on DigitalOcean
DNS records on DigitalOcean can be managed in Networking menu.
Using a Subdomain For Email With Mailgun on DigitalOcean
If you use a subdomain, e.g. mg.mikkohaapanen.com, don’t modify DNS records for domain mikkohaapanen.com on DigitalOcean. Instead you need to add a new domain on DigitalOcean that is your Mailgun subdomain, e.g. mg.mikkohaapanen.com.
If you choose not to use a separate subdomain, just add the records for the domain on DigitalOcean.
Add DNS Records For Sending
Two TXT
records.
Add settings to DigitalOcean.
Note that the values must be added inside quotes.
Note that you don’t insert the whole domain, just the part in front of it. If you need to refer to the domain without any additional prefixes, use @.
Add DNS Records For Tracking
Note that hostname must end in a dot.
Add DNS Records For Receiving
Note that hostname must end in a dot.
Ready!
Now your DigitalOcean DNS records for the subdomain should look like this:
Next, go to Mailgun and check that the settings are working.