← All guides

Troubleshooting DNS and mail records: MX, SPF, DKIM, DMARC

Find where delivery failed, check the DNS names that matter, and verify fixes with a fresh message.

Start with the symptom and the recipient's evidence

Get a single failing example with its sender, recipient, time, and any SMTP response or delivery notification. Ask whether the message was rejected, deferred, or accepted into spam. A 4xx SMTP response is temporary. A 5xx response is a permanent failure for that attempt. Preserve the text after the code. It may give a specific reason such as a bad recipient, a policy rejection or failed authentication. SMTP reply categories

If the recipient has the message, paste its original headers into the Email Header Analyzer and check Authentication-Results from the trusted receiving service. If no copy is available, ask the sender or recipient's mail administrator for a message trace or queue event. Check how many senders or recipients are affected. A problem isolated to one campaign points to a different set of records than a problem across all inbound mail after a migration. Exchange Online message trace examples

Check inbound routing with MX records

Use DNS Lookup to query MX at the domain after the recipient's @. The lower preference number is tried first. Check that each exchange host belongs to your intended receiving provider and resolves to an A or AAAA address. An MX target should be a hostname with address records and should not be an alias. An explicit null MX (0 .) signals that the domain accepts no mail. If there are no MX records and the domain exists, SMTP can fall back to the domain's address records. SMTP address resolution, MX target rules, Null MX

For example, suppose example.com still prefers mx-old.example.org at preference 10, and mx-new.example.org is set to 20. Senders can try the old server first. If it accepts mail into an old account or rejects a valid recipient, inspect its logs and compare the entire live MX set with the new provider's instructions. Fix stale routing before changing outgoing authentication.

Check SPF at the envelope sender domain

Find smtp.mailfrom in trusted authentication results or get the actual envelope domain from the sending service. Query TXT there with the SPF & DMARC Checker. Count records starting with v=spf1. Two independent SPF TXT records cause permerror. A single TXT record split into multiple quoted strings can be valid. Consolidate authorized senders into one policy and keep unrelated TXT entries.

Expand the path through include and redirect, including terms such as a and mx reached in nested records. The cap is 10 DNS-querying terms per SPF evaluation. The checker estimates the count at the top level. Audit each sending path, then remove obsolete sources. If a provider maintains changing IP ranges, verify any redesign with that provider before replacing an include with static addresses. SPF processing limits

Check the DKIM selector and DMARC policy placement

In DKIM-Signature, take s= for the selector and d= for the signing domain. If they read s=outbound and d=example.com, look up TXT at outbound._domainkey.example.com. If the provider uses a CNAME for the selector, check its target and confirm the published TXT there too. Compare the name with your provider's instructions, particularly after key rotation or if a DNS dashboard automatically appends the zone name. Then send a fresh message. The receiver needs to validate the signature against the key. A key visible in DNS is only one prerequisite. DKIM key lookup, Microsoft 365 CNAME example

For From: [email protected], check for a DMARC TXT record beginning with v=DMARC1 at _dmarc.example.com. Publishing it at example.com puts it at the wrong name for DMARC. For mail from a subdomain, check its exact policy name and the relevant inherited policy. SPF can pass for a provider's unrelated bounce domain while DMARC fails. Fix the envelope alignment or configure the provider to sign with an aligned DKIM domain, and verify the pass in a received test. DMARC policy discovery and alignment

Account for TTL and cached absence

Ask the authoritative DNS server what it serves and compare that with a recursive answer. A recursive resolver can serve an earlier answer until its cached time to live (TTL) expires. In a planned change, lower the TTL in advance and allow the previous TTL to elapse before changing the destination. A resolver can also cache that a name or record type did not exist. If its answer is still absent just after you publish a fix, check the authoritative answer and the zone's negative caching settings. Record the query time and resolver so the next analyst can reproduce your observation. DNS TTL, Negative caching

Time a provider cutover around caches and queues

Before switching providers, capture the old MX, address and authentication records and identify who can restore them. During an inbound cutover, keep the previous receive path available for an overlap period when possible. Check both providers' logs for delayed attempts and old-route traffic before retiring it. An SMTP sender can queue and retry after temporary failures, and a resolver may still have an earlier MX answer cached. When rotating DKIM on outbound mail, use a new selector and retain the old public key long enough for in-transit messages signed with it to reach their verifiers. SMTP retry behavior, DKIM selector rotation

Remove dangling CNAMEs and retest delivery

During a provider migration, review aliases for retired services. A CNAME pointing to a deleted third-party resource can become a subdomain takeover risk if the provider lets someone else claim the target. Confirm ownership and resource status in your provider console. Coordinate with the service owner to remove the obsolete alias or repoint it to an authorized resource. Check the authoritative zone again after the change. Microsoft guidance on dangling DNS entries

Retest inbound and outbound mail separately. For mail still landing in spam after authentication passes, read the recipient's trace or filtering reason and review its sender requirements, including reputation and complaint rates. For bulk mail, consult both providers' current rules and use the Gmail and Yahoo sender setup guide for record placement. Its pct example reflects an older DMARC specification. See the SPF & DMARC Checker for current rollout guidance. Record the final DNS answers and a fresh delivery sample for the next migration.