Setting up mailgun through WHM but having DNS issues
I’m trying to configure mailgun for my domain and running into problems with the SPF record in WHM’s DNS zone editor.
The SPF record I need to add is:
v=spf1 include:mailgun.org ~all
When I create this as a TXT record in WHM without quotes, it automatically gets truncated to just v=spf1 which is obviously wrong. If I wrap it in quotes, WHM accepts the full record but mailgun’s verification system doesn’t detect it properly.
Interestingly, another TXT record for the DKIM key (k1._domainkey) works fine with quotes and mailgun recognizes it without issues.
How should I properly format this SPF record in WHM? Should I be entering it differently or could there be another issue? Also, what’s the best way to verify that the TXT record is actually published correctly in DNS?
I’m pretty new to DNS management beyond basic MX records, so any guidance would be helpful.
could be dns caching on mailgun’s end. re-enter ur domain in their dashboard to force a fresh lookup. also double-check for old spf records hanging around, whm loves creating duplicates that break validation.
SPF records are a pain with WHM, but here’s what actually works.
The real problem isn’t formatting - it’s that manual DNS management breaks constantly. I’ve dealt with this on tons of domains and automation is the only thing that never fails.
Set up a workflow that watches your DNS records and fixes them automatically when they get screwed up:
Check your current SPF record via DNS lookup
Compare it against what it should be
Update it through WHM’s API when there’s a mismatch
Trigger Mailgun’s validation again
No more guessing about quote formatting or dealing with WHM’s weird TXT record behavior. The automation handles all the edge cases and keeps your records right even when WHM decides to “help” by changing them.
I use this for all email service integrations now because every provider has different validation timing and DNS propagation is unpredictable.
You can build this workflow easily without coding using Latenode. It connects directly to WHM’s API and Mailgun, so you get reliable DNS management that just works.
I encountered a similar issue with Mailgun recently. First, ensure you don’t have a pre-existing SPF record in your DNS zone, as WHM doesn’t replace them but rather appends to the existing record, which can cause problems. If you find one starting with v=spf1, add include:mailgun.org to it. For example, modify v=spf1 a mx ~all to v=spf1 a mx include:mailgun.org ~all. If there’s no existing record, create one in WHM’s basic DNS zone editor using the correct format: “v=spf1 include:mailgun.org ~all” with quotes included. After making changes, check using a DNS lookup tool to verify if it’s properly propagated before attempting Mailgun’s validation again.
Had the same problem with Mailgun and WHM. For the truncated SPF record, use the advanced DNS zone editor and escape your quotes like this: "v=spf1 include:mailgun.org ~all". Wait 15-20 minutes for DNS propagation, then check with dig yourdomain.com TXT. If Mailgun still won’t verify, try re-entering your domain to clear their DNS cache. WHM handles TXT records weird sometimes, which is why DKIM and SPF records act differently.
try addin it without quotes but with a period at the end: v=spf1 include:mailgun.org ~all. WHM sometimes needs that trailing dot for TXT records. also make sure u dont already have an SPF record - you cant have multiple ones or validation breaks.
Check if you’re hitting WHM’s character limit for TXT records in the basic editor. I had this exact issue and switching to the advanced zone editor fixed the truncation completely. Enter the record as: “v=spf1 include:mailgun.org ~all” with escaped quotes in advanced mode. Some WHM versions have a bug where they strip content after certain characters in the basic editor - that’s why your DKIM works fine but SPF gets mangled. After adding it, verify with nslookup or an online DNS checker instead of trusting WHM’s preview. The interface sometimes shows wrong formatting even when the actual DNS record is correct. Wait about 30 minutes before testing with Mailgun’s validator.