If transactional password resets, invoices, or outreach emails are landing in spam—or attackers are sending phishing emails pretending to come from your domain—the root cause almost always lives in four DNS and mail-transport layers: MX, SPF, DKIM, and DMARC.
Major inbox providers including Google Workspace/Gmail, Microsoft 365/Outlook, and Yahoo Mail strictly enforce email authentication for bulk and domain senders. Guessing DNS TXT strings or copying mismatched templates creates silent permerror failures that tank deliverability overnight. Here is how each protocol works, how they connect, and how to debug them cleanly.
How MX, SPF, DKIM, and DMARC Work Together
Each record defends a different piece of mail routing and identity:
- MX (Mail Exchanger): Tells the internet which mail servers receive incoming email for your domain, ordered by priority integer (lowest number = highest priority).
- SPF (Sender Policy Framework — RFC 7208): A DNS
TXTrecord listing which IP addresses and third-party services are authorized to send mail claiming your domain in the SMTPMAIL FROM(Return-Path) envelope. - DKIM (DomainKeys Identified Mail — RFC 6376): A cryptographic signature added to email headers (
DKIM-Signature:) by the sending server, verified against a public key published at<selector>._domainkey.yourdomain.com. Proves the message was not tampered with in transit and truly originated from someone holding the private key. - DMARC (Domain-based Message Authentication, Reporting, and Conformance — RFC 7489): A policy record at
_dmarc.yourdomain.comthat ties SPF and DKIM together via alignment with the visibleFrom:header users actually see—and tells receiving servers whether to monitor (none), quarantine (quarantine), or reject (reject) spoofed mail.
Step 1: Verify MX Routing and Live SMTP Transport
Even though outbound authentication centers on SPF, DKIM, and DMARC, broken MX or SMTP configurations degrade domain reputation and bounce receipts.
Check your domain with MX Record Checker and SMTP Test:
- Confirm MX hosts point to real hostnames (
A/AAAArecords), never to aCNAMEor raw IP address (prohibited by RFC 5321). - Verify the receiving server greets cleanly (
220), answersEHLO, and advertisesSTARTTLSwith a valid TLS certificate so inbound mail encrypts in transit. - If your domain does not receive email at all (for example, a parked or marketing-only lookalike domain), publish a "null MX" record (
0 .) alongside a strictv=spf1 -allandp=rejectDMARC record so attackers cannot hijack it.
Step 2: Configure SPF Without Breaking the 10-Lookup Limit
An SPF record lives as a TXT record at your root domain (@ / apex). Every domain must publish at most one v=spf1 TXT record—publishing two separate v=spf1 records causes an immediate permerror failure across receivers!
A clean baseline SPF record looks like this:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
The Fatal SPF Traps That Break Deliverability
- Exceeding the 10-DNS-lookup limit (RFC 7208 Section 4.6.4): Each
include:,a,mx,ptr,exists, andredirect=mechanism triggers a DNS lookup—including nestedinclude:chains inside your email vendors! Once evaluation hits lookup #11, receivers returnPermErrorand fail SPF completely. Keep lookups lean (ideally 6 or fewer) and never useptr(explicitly deprecated by RFC 7208). - Using
+all: Writing+allliterally authorizes every IP address on the entire internet to spoof your domain. ~all(SoftFail) vs.-all(HardFail): When paired with an enforced DMARC policy (p=quarantineorp=reject), both~alland-allprevent unauthorized mail from passing SPF. Many deliverability engineers prefer~allduring active DMARC rollout so mailing-list forwarders don't drop legitimate mail before DKIM alignment evaluates cleanly, while-allexpresses strict rejection when every legitimate sender is verified.- Publishing multiple SPF records: Always merge new senders into the single existing
v=spf1 ...string rather than adding a secondTXTrow in your DNS panel.
Inspect what public resolvers actually see right now using SPF Checker.
Step 3: Deploy 2048-Bit DKIM Keys and Rotate Selectors
SPF breaks easily whenever emails get forwarded (because the forwarding server's IP isn't in your SPF record, changing the envelope Return-Path). DKIM survives forwarding as long as the signed headers and message body stay intact.
Your mail provider (Google Workspace, Microsoft 365, Postmark, Amazon SES, SendGrid, Mailgun) generates a keypair and asks you to publish the public key under a specific selector:
selector1._domainkey.yourdomain.com TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..."
Key hygiene rules for 2026:
- Use 2048-bit RSA keys (or Ed25519 where supported): Avoid legacy 1024-bit keys where your provider lets you upgrade; shorter keys are increasingly flagged as weak cryptographic posture.
- Check DNS provider character limits: A 2048-bit DKIM
TXTvalue exceeds 255 characters. Properly formatted DNS zones split longTXTstrings into adjacent quoted 255-byte chunks inside a single record—modern providers like Cloudflare handle this automatically, whereas older registrar panels sometimes silently truncate keys. - Keep old selectors briefly when rotating: Publish the new selector (e.g.,
s2._domainkey), switch signing in your ESP, wait 48 hours for DNS TTLs and queued mail to drain, and then retire the old selector.
Verify your selector's TXT record directly with DKIM Checker.
Step 4: Enforce DMARC Safely (none -> quarantine -> reject)
Publishing SPF and DKIM alone does not prevent a phisher from spoofing your visible From: ceo@yourdomain.com header! An attacker can pass SPF using their own envelope domain (bounce@evil-phish.com) while displaying your domain in the From: line unless DMARC enforces Identifier Alignment.
DMARC requires at least one of SPF or DKIM to both pass AND align with the organizational domain in the visible From: header.
Safe 3-Stage DMARC Rollout
Never jump straight to p=reject on day one if multiple departments send mail through CRM, ticketing, billing, or newsletter tools you haven't inventoried yet.
Stage 1 — Monitor (p=none): Collect aggregate XML reports (rua) without blocking any mail:
_dmarc.yourdomain.com TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; fo=1"
(Publish at _dmarc.yourdomain.com using strictly v=DMARC1; at the start.)
Stage 2 — Quarantine (p=quarantine): Once 2–4 weeks of aggregate reports confirm every legitimate sender (billing, helpdesk, web app, workspace email) passes DKIM or aligned SPF, move suspicious unaligned mail to spam:
v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc-reports@yourdomain.com; adkim=r; aspf=r
Stage 3 — Reject (p=reject): Instruct compliant receivers to drop unauthenticated domain spoofing at the SMTP door:
v=DMARC1; p=reject; pct=100; rua=mailto:dmarc-reports@yourdomain.com; sp=reject; adkim=r; aspf=r
Notice sp=reject—this explicitly protects unused subdomains (like mail2.yourdomain.com or support.yourdomain.com) from being spoofed by phishers! Test your live _dmarc record right now with DMARC Checker.
Step 5: Inspect Real Headers and Check Sending IP Reputation
When an authenticated email still hits spam or bounces, inspect the raw Authentication-Results: header from a test message sent to a personal inbox using Email Header Analyzer:
- Look for
spf=pass,dkim=pass, anddmarc=pass. - If
spf=passbutdmarc=fail, check alignment: your ESP's envelopesmtp.mailfromdomain doesn't match yourheader.fromdomain, and DKIM isn't signing with your custom domain! Configuring a custom return-path CNAME and custom DKIM domain fixes alignment immediately. - If you send from a dedicated VPS or mail server IP, verify your IP hasn't landed on a DNSBL blocklist via IP Blacklist Checker, and ensure your reverse DNS (
PTR) matches your mail server'sHELO/EHLOhostname.
For broader DNS cutover and certificate debugging, keep our DNS, TLS, and Network Troubleshooting Runbook bookmarked.
Frequently Asked Questions
Can I have two DMARC records for one domain?
No. Like SPF, a domain may only publish one TXT record at _dmarc.yourdomain.com. Multiple _dmarc records cause receivers to ignore DMARC evaluation entirely.
Why did SPF fail when a contact forwarded my email?
Traditional email forwarding changes the connecting server IP and often keeps the original Return-Path, causing SPF to evaluate the forwarder's IP against your SPF record and fail. As long as your outbound email carries a valid DKIM signature matching your From: domain, DMARC still passes!
How long do DNS updates for SPF, DKIM, or DMARC take to apply?
New records usually appear on public resolvers within seconds to minutes, while changes to existing records depend on the record's previous TTL (Time To Live)—typically 5 minutes to 24 hours. Verify live resolution across resolvers with DNS Checker.
Audit Your Domain's Email Posture Now
Run every check in this guide from your browser in two minutes:
- Check your
v=spf1record via SPF Checker. - Look up your selector key via DKIM Checker.
- Verify
_dmarcpolicy tags with DMARC Checker. - Test MX routing and live
STARTTLShandshakes using MX Record Checker and SMTP Test. - Inspect raw bounce/inbox headers with Email Header Analyzer and check blocklists with IP Blacklist Checker.