Setup MailGun on NameCheap: SPF, DKIM, CNAME and MX

MailGun is an awesome tool to help you manage your emails for marketing and other tasks. Configuring a domain is usually easy with MailGun by following MailGun’s instructions (it supports GoDaddy, NameCheap, Amazon Route 53 and various other things).

Setting up a subdomain on MailGun is easy when your domain name is purchased on However, it’s very confusing to configure a subdomain on After spending a couple hours researching this topic, I finally figure it out. There are some helpful articles out there such as this, which gave me some good leads. However none of them really work at this time. So I would like to share my findings to save you some extra hours.

Assuming your domain is YOURDOMAIN.COM, and you want to use “test” as your subdomain. The following pictures show the suggested settings from MailGun after you added the subdomain. The greyed out parts are the domain and the DKIM passwords. This setting works correctly for GoDaddy. But it FAILED with NameCheap.

After spending several hours researching on the topic, I finally figured out the correct solution. The changes are simple. But it really takes quite a while (and several beers to calm down) to wait for the DNS update after each testing. Also, it seems to me that MailGun’s manual DNS testing is not really “realtime” as it claims to be. Anyway, here’s the working solution for me.

SPF Record for test.YOURDOMAIN.COM
DKIM record for test.YOURDOMAIN.COM
MX records for

Unfortunately MailGun’s support hasn’t been very helpful, that’s why I thought it’d be good to share the solution. Hopefully it makes your life a bit easier.

Founder of, Bug Maker And Fixer

Founder of, Bug Maker And Fixer