Syndicated on Medium.
Mailgun is a service that lets developers programmatically send and receive emails. Namecheap is a domain registrar. I wanted to setup Mailgun to use custom email with the domain I manage using Namecheap. But I stumbled on some issues with settings.
I eventually got it working, and I’m sharing my solutions here just in case someone else hits the same blocks with these (or other) email and domain services.
Let’s get to it!
By this point, you have already added your domain to Mailgun. Now you need to add Mailgun-related DNS records to your domain.
While setting up, I followed the steps given by Mailgun. For each record it came down to:
- Choosing a type of record from the dropdown
- Setting the hostname
- Entering the DNS value, which is given to me by Mailgun (I’ve not included this in the screenshots later on, because security 💁🏽)
But their recommended entries (see screenshots) at steps 2 did not work for me.
Instead I did the following.
SPF & DKIM
For the first TXT record, it asked me to put the domain as the hostname. I used the
@ sign instead, because Namecheap uses the “@” sign to represent your domain.
For the second TXT record, it said to enter a hostname that was
foo.bar.my-domain. Instead I used only the
MX records are mail server records. In the Mail Settings section of the Advanced DNS panel on your Namecheap interface, select Custom MX so you can enter your Mailgun records.
The section about MX records in the Mailgun guide did not mention it but you need to set the host as your domain. So under host, put
@. Also just set TTL (time to live) as Automatic.
Now, Mail Settings on the Advanced DNS panel should look like this.
By now the setup is enough for Mailgun to verify your DNS. This last one is considered optional.
Instead of entering
email.your-domain in the hostname field, just enter
The settings I’ve described above should let you use Mailgun with your domain. In case you stumbled on the same blocks I encountered, I hope you find this helpful! 💛