Wordpress and Mailgun – Making the Records Verify
If you are here you already know why we are using Mailgun with WordPress, so we’ll skip that.
Mailgun DNS Records Won’t Verify!
I tried a number of solutions to get mailgun to verify my DNS records and it was a nightmare guessing game. That being said, I figured it out.
A quick note on SPF records before we continue:
SPF Records and Subdomains vs. Single Domain
You cannot have two SPF records for a single domain, meaning that this below is not allowed:
somedomain.com txt "v=spf1 include:somedomain.com ~all" somedomain.com txt "v=spf1 include:anotherdomain.com~all"
However, you can combine the records into one record:
somedomain.com txt spf "v=spf1 include:somedomain.com include:anotherdomain.com ~all:
But know that subdomains can have their own SPF records so that this below is allowed:
somedomain.com txt "v=spf1 include:somedomain.com ~all" subdomain.com txt somedomain.com txt "v=spf1 include:otherdomain.com ~all"
Here’s what you have to do to make it work (assuming you are using mg.mydoman.com with Mailgun):
- create the new subdomain in cPanel (or in whatever manner you use to create subdomains)
- mailgun is then going to tell you that you need to add an SPF record for: mg.mydomain.com. The problem is that (at least in WHM’s edit dns feature) — you need to leave out the trailing “mydomain.com”
- [box style=”1″]
Your SPF Record for Mailgun should look like this:
mg txt "v=spf1 include:mailgun.org~all"
mg.mydomain.com txt "v=spf1 include:mailgun.org~all"
- The same thing now applies for the DKIM. Mailgun will tell you to use:
but what you need to use is this:
Once I realized the error I was making and made these changes, my domain verified instantly.
Hope this helps!