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

Hui
Hui
Jul 12, 2016 · 2 min read

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 GoDaddy.com. However, it’s very confusing to configure a subdomain on NameCheap.com. 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.

Image for post
Image for post
Image for post
Image for post

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.

Image for post
Image for post
CNAME Record for test.YOURDOMAIN.COM
Image for post
Image for post
SPF Record for test.YOURDOMAIN.COM
Image for post
Image for post
DKIM record for test.YOURDOMAIN.COM
Image for post
Image for post
MX records for test.YOURDOMAIN.com

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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store