Insights

Moved DNS to a New Provider and Email Broke? Diff the Old and New Zone With dig

November 6, 2026
0:00
You moved a domain's nameservers to a new DNS provider, the website still loads, and the switch looked done. Then mail starts bouncing, a domain verification check fails, or a subdomain like webmail or shop stops resolving. In most of these cases the mail server and the new DNS host are fine. The new zone just doesn't contain every record the old one had.
When a zone gets copied by hand, people copy what they see and remember: the apex A record and www. Those are exactly the records that make the website work, so the first test after the switch passes and everyone moves on. The records that get left behind are the ones nobody looks at day to day. MX records. The SPF TXT record. DKIM public keys under _domainkey. The _dmarc record. Verification tokens added years ago for a search console or an email suite. autodiscover and SRV records that mail clients use for automatic setup. CAA records. Subdomains someone created once and forgot about. Some providers offer an import that scans for common names. That helps, but a scan can only find names it guesses. A DNS zone usually can't be listed from the outside: zone transfers (AXFR, the mechanism that copies a whole zone between servers) are normally restricted to approved secondary servers. So anything the import didn't guess, it didn't copy. This is why a support desk can get two tickets that sound unrelated, mail broke and a domain is suddenly unverified, for the same domain on the same day.
Three explanations come up before anyone looks at the zone itself. The first is that delegation hasn't actually changed. If public resolvers still return the old nameservers, you're dealing with a delegation problem at the registry level, not missing records, and that needs to be sorted out first. The second is propagation. Propagation explains a mix of old and new answers while caches expire. It does not explain a record that is absent on the new authoritative server. Waiting won't create it. The third is the mail server. If the mail server accepts connections and its logs show nothing arriving for the domain, the problem is upstream: senders can't work out where to deliver. The cleanest way to separate these is to stop asking resolvers and ask the authoritative servers directly. An authoritative server is the one that actually holds the zone, so its answer isn't affected by anyone's cache.
BASH
# Which nameservers the domain is delegated to now (via your normal resolver)
dig NS example.com +short

# Ask the new and old authoritative servers directly, bypassing caches
dig @ns1.new-dns.example example.com MX +norecurse
dig @ns1.old-dns.example example.com MX +norecurse
Read the header of each answer, not just the records. The aa flag means the server answered authoritatively. A status of NOERROR with an empty answer section means the name exists but has no record of that type. NXDOMAIN means the name doesn't exist in that zone at all. REFUSED from the old server usually means it no longer hosts the zone. That last case matters. If the old provider has already dropped the zone, your source of truth becomes a zone file export, a backup, or the record list in the old control panel. If the old server still answers, export or save what it has before anything else changes.
Since you can't list the zone over DNS, build the list of names yourself. Good sources are the old panel's zone editor, an exported zone file, and the services the domain actually uses. For DKIM, open the headers of a message the domain sent before the switch: the DKIM-Signature header has an s= tag with the selector, and the record lives at selector._domainkey.yourdomain. Then query every name and type on both servers and print only the differences:
BASH
#!/usr/bin/env bash
# Compare records on the old and new authoritative servers.
# Replace these placeholders with your real nameservers and domain.
OLD='ns1.old-dns.example'
NEW='ns1.new-dns.example'
DOMAIN='example.com'

# '@' means the zone apex. Add your own subdomains and DKIM selectors.
NAMES='@ www mail webmail autodiscover autoconfig _dmarc default._domainkey _autodiscover._tcp'
TYPES='A AAAA CNAME MX TXT CAA SRV'

for name in $NAMES; do
  if [ "name" = '@' ]; then fqdn="DOMAIN"; else fqdn="name.DOMAIN"; fi
  for type in $TYPES; do
    # Sort so that answer order doesn't create false differences
    old=(dig @"OLD" "fqdn" "type" +short +norecurse | sort | paste -sd ' ' -)
    new=(dig @"NEW" "fqdn" "type" +short +norecurse | sort | paste -sd ' ' -)
    if [ "old" != "new" ]; then
      echo "fqdntype | old: {old:-<none>} | new:{new:-<none>}"
    fi
  done
done
It only uses read-only queries, so it's safe to run as often as you like. The sort step is there because servers don't guarantee the order of multiple answers, and two identical MX sets can come back in different orders. A few differences are expected and not a problem. Long TXT values like DKIM keys can be split into several quoted strings, and two providers may split the same value at different points, so compare the content, not the quoting. Some providers flatten a CNAME at the apex or proxy records through their own network, so the A records at the apex can legitimately differ. And if a whole column says <none> for the old server, check that it still answers for the zone before trusting the comparison. Any line where the old server has a value and the new one shows <none> is a missing record. That's your fix list.
Knowing what a missing record breaks makes it easier to match the diff to the symptoms people are reporting. A missing MX record doesn't always cause an immediate bounce. Under the SMTP standard, when a domain has no MX, senders fall back to the domain's own A or AAAA record. That usually means mail gets sent to the web server's IP. If that machine doesn't accept mail for the domain, delivery fails, but senders typically retry for a while before giving up. So complaints can arrive hours or days after the switch, which makes the cause harder to connect. An MX record can also be present but point at a hostname like mail.example.com that wasn't copied. The MX then leads nowhere. Without the SPF TXT record, receivers can't confirm which servers are allowed to send for the domain. Without the DKIM key, signatures on outgoing mail can't be verified. Either one tends to push mail into spam or into rejection when the domain has a strict DMARC policy. A missing _dmarc record removes the policy and stops aggregate reports, so the problem can go unnoticed longer. Missing autodiscover, autoconfig, or SRV records mostly hurt new mail client setups. Existing accounts configured with a fixed hostname keep working as long as that hostname still resolves. Verification TXT records are the quiet ones. Many services re-check them periodically, so a domain can show as verified for a while and then flip to unverified later.
The fix is to add the missing records on the new provider, copying values exactly. Then verify in this order:
  1. Re-run the diff against the authoritative servers until only expected differences remain.
  2. Check the same names through a public resolver, and keep negative caching in mind.
  3. Send a test message from an outside mailbox and read the Authentication-Results header for spf=pass, dkim=pass, and dmarc=pass.
  4. Trigger the verification check again in each service that uses a TXT token.
Step 2 is where people get confused. When a resolver asks for a record that doesn't exist, it caches that negative answer too. The duration comes from the zone's SOA record: the lesser of the SOA record's own TTL and its minimum field, the last number in the record.
BASH
# The last number in the SOA answer is the negative caching value, in seconds
dig @ns1.new-dns.example example.com SOA +noall +answer
If that value is large, a resolver that looked up your MX while it was missing can keep saying it doesn't exist for that long, even though the new authoritative server now has it. Querying the authoritative server tells you the fix is in place. The resolver just needs time. Leave the old zone untouched until everything passes. It's your reference copy, and deleting it early removes the only easy way to answer the question of what used to be there. For next time, the same loop works before the switch, not just after. Most providers answer authoritatively for a zone as soon as it's created, so you can diff old and new servers while delegation still points to the old provider, fix every gap, and only then change the nameservers. That turns a mail outage into a five-minute check.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.