Skip to content

Field Notes

SPF, DKIM, and DMARC: A Practical Email DNS Configuration Guide

Learn how SPF, DKIM, DMARC, MX, alignment, selectors, lookup limits, MTA-STS, and TLS-RPT work together in email DNS.

EmailLinkedIn
Email authentication evidence pathVisible FromMXSPFDKIM selectorDMARC alignmentReceiver result
Email authentication evidence path
Record / mechanism Purpose Common trap
MX Routes inbound mail Valid DNS does not prove mailbox acceptance
SPF Authorizes envelope-sender infrastructure Multiple records or too many lookups cause failures
DKIM / DMARC Signs mail and evaluates aligned identity A selector or DNS pass alone does not prove delivery
On this page

Environment covered: Public email domains using SaaS senders, transactional mail, CMS forms, DNS providers, MX records, SPF, DKIM, DMARC, MTA-STS and TLS-RPT

SPF authorizes an SMTP sending identity. DKIM signs a message under a domain. DMARC checks whether a passing identity aligns with the domain in the visible From header. Publishing all three records does not, by itself, demonstrate that the next message will satisfy them.

For a notification service, establish that the message reached the provider before debugging authentication. Then use an authorized test message to connect the DNS policy to the identities actually used on the wire.

The notification failure and message headers below are fictional examples, informed by queue and mail-validation work. They contain no real recipient, provider trace or customer message.

Confirm the failure is downstream of the worker

Start with the application’s event identifier and follow it through enqueue, worker attempt, provider response and any later delivery event. A successful web request is not a mail receipt. Neither is a worker log written before the provider call completes.

In this example, the worker’s provider call succeeds. That moves the investigation beyond queue admission, but it does not prove inbox placement. Check whether the response means accepted for processing, delivered to the receiving server or something stronger. Provider terminology varies.

If a worker retries after losing a response, it may also send a duplicate. Keep retry and idempotency behavior separate from DNS authentication. Repairing a mail record will not fix a job that was never processed or a retry that created two messages.

Worked message: authentication passes, alignment fails

The next useful artifact is a message accepted by a test recipient, or a provider event explaining a failed attempt. Use an authorized test mailbox and redact the resulting evidence before sharing it.

Reconstructed header summary; not a captured message
From: Service alerts <alerts@example.com>
Return-Path: <bounce@mailer.example.net>
DKIM-Signature: v=1; d=mailer.example.net; s=demo; ...
Authentication-Results: receiver.example;
    spf=pass smtp.mailfrom=mailer.example.net;
    dkim=pass header.d=mailer.example.net;
    dmarc=fail header.from=example.com

The fictional receiver authenticated the provider’s domain. It did not find a passing identity aligned with the visible From domain. Passing SPF and DKIM for the wrong domain therefore did not make this message pass DMARC.

That is why changing the MX record would be an unrelated repair. MX primarily directs inbound delivery. It does not choose the signing identity of this outbound message.

Configure SPF for the actual envelope sender

SPF normally evaluates the SMTP envelope sender’s domain, with defined HELO behavior in particular cases. It does not directly authenticate the display address the recipient reads.

A sender inventory should include website forms, alert workers, support systems and any other legitimate sender for the domain. Publish one SPF policy at the relevant name. Multiple TXT records starting with v=spf1 are not combined into a larger policy by the receiver.

Illustrative policy; the provider domain is documentation-only
v=spf1 include:_spf.example.net -all

An include is not a harmless label. Its evaluation can trigger further lookups and bring nested policies into the budget. RFC 7208 limits DNS-querying terms during evaluation; the familiar limit is not simply a count of words in the top-level TXT value. Review the actual expansion and errors before merging records or flattening provider ranges into a maintenance burden.

Forwarding is another reason not to stop at SPF. The receiving server may see the forwarder’s address rather than the original sender. A sender rewrite can change that path, but it does not automatically solve every visible-domain alignment requirement.

Publish the selected DKIM key, then verify a signed message

The d= value identifies the signing domain and s= identifies the selector. A receiver uses both to find the public key. There is no universal record called “the DKIM record” at the apex of every domain.

dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short TXT demo._domainkey.example.com

These queries demonstrate names, not an assertion that these documentation domains publish the example policies. Obtain the actual selector from approved sender configuration or a message’s signature; guessing popular selector names cannot prove DKIM is absent.

A published key proves only that DNS returned a key record. The sending system must use the corresponding private key, sign the intended content and select the correct domain. Delayed mail and forwarding can complicate rotation because an older signature may still be in transit. Body or signed-header modification can also invalidate a signature that was correct at send time.

In the fictional repair, the provider is configured to sign with an authorized domain aligned with example.com. A subsequent test checks the observed authentication result. Adding a DNS record without verifying the next message would leave half of the repair untested.

Observe alignment before tightening DMARC

DMARC passes when at least one successful mechanism also meets the required domain alignment. Relaxed and strict alignment are different choices; use the policy the sender architecture can actually satisfy. Receiver disposition still involves receiver policy, so a published reject request is not a delivery guarantee.

Start an authentication rollout with sender inventory and observation rather than an immediate restrictive policy. An illustrative monitoring record is:

v=DMARC1; p=none; rua=mailto:reports@example.com; adkim=r; aspf=r

Use a real, owned report destination in deployment, with retention and privacy controls. Review legitimate sources before tightening disposition. The current core specification is RFC 9989; older guides based on RFC 7489 can describe legacy behavior. Do not copy obsolete rollout tags without checking the specification and receiver implementation.

Transport security answers another question

MTA-STS and TLS reporting concern SMTP transport to a receiving domain. They can help define and observe secure delivery paths; they do not replace sender authentication or repair an unaligned signing domain. A web certificate check also cannot prove the SMTP path is healthy.

Likewise, an inbound MX record can be syntactically correct while its target has no usable address, the recipient mailbox is unavailable or the server refuses the transaction. Distinguish a domain that intentionally receives no mail from one whose inbound service is broken before recommending changes.

Scope the final delivery check

For the fictional incident, closure means the application created the intended job, the worker handled it once, the provider accepted it, and a controlled recipient produced useful authentication and delivery evidence. A missing message still requires checking bounces, suppression, recipient filtering and reputation after DNS is correct.

The Email DNS Checker can inspect supported domain records, while DNS Propagation Checker compares selected recursive views during a change. Neither discovers every DKIM selector or certifies inbox placement.

Keep the test message’s authentication result beside the sender configuration and DNS change record. Repeat that check after a provider change, selector rotation or new sending application. A previously green DNS check cannot certify the identities used by a later message.

Sources and further investigation

References support the protocol and product behavior discussed here; they are not evidence that the illustrative scenario occurred.

Continue the investigation

Need a second set of eyes?

Working through a similar production issue?

Discuss the technical context