Scan before attackers do.·Powered by silentwolf.io
DocsSupportContactLogin

SPF, DKIM and DMARC Explained: Stop Spoofing

SPF, DKIM and DMARC explained: what each record proves, how alignment works, how to roll out a DMARC policy safely, and the mistakes that break mail delivery.

Published 8 min readBy the Scanbe4 teamEmail securityDNSBrand protection
In short
  • SPF lists the servers allowed to send mail for your domain; DKIM signs each message with a key published in DNS.
  • DMARC passes only when SPF or DKIM passes for a domain that matches the visible From address, and it tells receivers what to do with mail that fails.
  • Roll DMARC out in stages: monitor with p=none, fix every legitimate sender, then move to quarantine and reject.

E-mail has no built-in proof of who sent it: the From line is just text. SPF, DKIM and DMARC are three standards, published in DNS, that let receiving servers check whether a message claiming to come from your domain really does. Large mailbox providers now expect them: since 2024, Gmail and Yahoo require bulk senders to publish SPF, DKIM and a DMARC record, and Microsoft announced similar rules for Outlook.com in 2025.

What SPF, DKIM and DMARC each prove

StandardPublished atWhat it checksWhat a pass proves
SPF (RFC 7208)example.com TXT v=spf1 …Whether the sending server’s IP address is allowed for the envelope sender (Return-Path) domainThis server may send for that envelope domain
DKIM (RFC 6376)selector._domainkey.example.com TXT v=DKIM1; p=…A signature over the headers and body, made with the key named by the d= and s= tagsThe signing domain took responsibility, and the signed parts were not changed
DMARC (RFC 9989)_dmarc.example.com TXT v=DMARC1; p=…Whether SPF or DKIM passed for a domain aligned with the header FromThe visible sender domain is backed by a check

SPF alone has two gaps: it checks the envelope sender, which recipients never see, and it breaks when mail is forwarded, because the forwarding server is not on your list. DKIM survives forwarding as long as the signed content is not changed, but it says nothing about the From address either. DMARC closes both gaps by tying the checks to the address people actually read.

Alignment: the part people miss

DMARC passes if at least one of these is true:

  • SPF passes, and the envelope sender domain aligns with the From domain.
  • DKIM passes, and the signing domain (d=) aligns with the From domain.

In relaxed mode, the default, aligned means the same organizational domain, so mail.example.com aligns with example.com. In strict mode (aspf=s or adkim=s), the names must match exactly. The classic failure is a sending service that uses its own domains:

From: Example News <news@example.com>
Return-Path: <bounce-7731@mail.sender-platform.example>
DKIM-Signature: v=1; a=rsa-sha256; d=sender-platform.example; s=s1; ...
Authentication-Results: mx.receiver.example;
  spf=pass smtp.mailfrom=mail.sender-platform.example;
  dkim=pass header.d=sender-platform.example;
  dmarc=fail header.from=example.com
Illustrative example: SPF and DKIM pass, but neither for example.com, so DMARC fails

The fix is in the service’s settings: DKIM signing with d=example.com, or a bounce domain under yours.

Reading a DMARC record

_dmarc.example.com.  TXT  "v=DMARC1; p=quarantine; sp=reject; rua=mailto:dmarc@example.com"
Illustrative example
TagMeaningValues
vVersion; must come firstDMARC1
pPolicy for the domain itselfnone (monitor only), quarantine (treat as suspicious, usually the spam folder), reject (refuse the message)
spPolicy for subdomains that exist; without it, p appliesnone, quarantine, reject
npPolicy for subdomains that do not exist; without it, sp or else p appliesnone, quarantine, reject
ruaWhere receivers send aggregate reports, usually dailyOne or more mailto: addresses
tTest mode: t=y asks receivers not to apply your policy in full; expect failing mail to be handled one level lower (reject as quarantine, quarantine as none)y or n; default n
adkim, aspfAlignment mode for DKIM and SPFr (relaxed, default) or s (strict)

If the rua address is on another domain, such as a reporting service, that domain must publish a record authorizing it, for example example.com._report._dmarc.reports.example.net. Note that DMARC was revised in May 2026: RFC 9989 replaces RFC 7489, adds np and t, and removes pct, the percentage tag many older guides use for gradual rollouts. Receivers adopt the changes at their own pace, so move between policies in steps rather than relying on pct.

Rolling out DMARC safely

  1. List every service that sends as your domain: your mail platform, and also marketing, CRM, support desk, invoicing, HR and recruiting tools, website forms, monitoring alerts and scanners. The list is usually longer than expected.
  2. Publish SPF and turn on DKIM for each sender, signing with your own domain wherever the service supports it.
  3. Publish p=none with an rua address. Nothing is blocked yet; receivers start sending reports that list every source of mail using your domain and whether it passed.
  4. Read the reports for several weeks, long enough to catch monthly senders such as invoicing or payroll, and fix each legitimate source until it passes with alignment. Prefer DKIM, which survives forwarding.
  5. Move to p=quarantine, keep reading the reports, then move to p=reject once only unknown or malicious sources fail. With receivers that support RFC 9989, you can publish each new policy with t=y first, so it is applied one level lower while you watch the reports.
  6. Keep a process: new tools that send mail must be set up for DKIM or SPF before they go live.

Common mistakes

  • Two SPF records. A domain may publish only one v=spf1 record; two produce a permanent error, so SPF stops passing. Merge them.
  • More than 10 DNS lookups. SPF allows at most 10 terms that need a DNS lookup (include, a, mx, ptr, exists and redirect), counting nested includes. Beyond that, SPF returns a permanent error.
  • +all or ?all. The first authorizes every server on the internet; the second says nothing. End with ~all or -all.
  • Third-party senders without DKIM, or signing with their own domain, as in the example above.
  • DMARC in the wrong place. The record belongs at _dmarc.example.com, and there must be only one.
  • Jumping straight to p=reject, so a forgotten sender stops delivering and nobody notices until a customer complains.
  • Old DKIM keys. Use 2048-bit RSA keys where your provider allows it, and rotate them.
v=spf1 ip4:192.0.2.10 include:_spf.mail-platform.example include:send.crm.example a mx ~all
Illustrative example: ip4 needs no lookup; each include, a and mx counts, plus the lookups inside included records

Subdomains and parked domains

Attackers spoof the names you do not watch: an unused subdomain, or a domain you registered defensively and never used for mail. Subdomains follow your main policy unless you set sp (and np for names that do not exist), so you can protect them early with sp=reject while the main domain is still at none. A subdomain that does send mail can publish its own DMARC record. A domain that never sends or receives mail should say so:

parked-example.com.         TXT  "v=spf1 -all"
_dmarc.parked-example.com.  TXT  "v=DMARC1; p=reject; sp=reject"
parked-example.com.         MX   0 .
Illustrative example: a domain that sends and receives no mail (null SPF, reject policy, null MX)

The last line is a null MX record (RFC 7505), which tells senders the domain accepts no mail. Add an rua address if you want reports about spoofing attempts.

How to check your records

dig +short TXT example.com | grep -i "v=spf1"      # exactly one SPF record
dig +short TXT _dmarc.example.com                  # the DMARC policy
dig +short TXT selector1._domainkey.example.com    # a DKIM key, if you know its selector
dig +short MX example.com                          # where your mail is received
Check the published records (replace example.com and the selector)

DKIM is the one you cannot fully check from outside: selectors are not listed anywhere, so you must know which name to ask for. Open the headers of a message you sent, read the s= and d= tags of its DKIM-Signature header, and look at the Authentication-Results header the receiver added, which shows the SPF, DKIM and DMARC verdicts for that message.

What Scanbe4 checks today
Scanbe4 reads the DNS TXT records found during each scan and reports whether an SPF record is published, with the record itself, under Issues › Configuration checks. It reports presence only: it does not count lookups or validate the syntax, so check those yourself as described above. A change to the SPF record between two scans appears in Assets › DNS history as a high-risk change and raises an alert. DMARC and DKIM are not checked reliably today: a scan does not look up _dmarc directly, so a published policy can be missed, and DKIM is not checked at all, so it always shows as unknown. Treat those two results as a prompt to check by hand, not as a verdict.

What DMARC does not stop

  • Lookalike domains. examp1e.com is a different domain, and its owner can publish perfect records of their own. See lookalike domain detection.
  • Display-name spoofing. “Example Support” with a webmail address passes every check, because the address is not yours.
  • Compromised accounts. Mail sent from one of your real mailboxes passes, because it is real; leaked credentials are often how that starts (see infostealer logs).
  • Receivers that apply their own policy. DMARC is a request; each receiver decides what to do with it.

DMARC is still worth doing: it takes exact-domain spoofing off the table and shows you who sends mail as you. It just needs company: lookalike monitoring, user awareness and well-protected accounts.

Frequently asked questions

Do I need SPF, DKIM and DMARC, or is one enough?

You need all three. SPF and DKIM each authenticate part of a message, and DMARC ties them to the From address people see and tells receivers what to do when the check fails. Large mailbox providers also require them from bulk senders.

Should my SPF record end in -all or ~all?

Both are acceptable. -all asks receivers to treat other sources as failing, ~all as suspicious. Once DMARC is at quarantine or reject, DMARC makes the decision, and many administrators keep ~all so that a receiver rejecting on an SPF failure alone does not drop forwarded mail that DKIM would have passed.

How long should we stay at p=none?

Until the aggregate reports show every legitimate sender passing with alignment. Plan for several weeks, long enough to cover monthly senders such as invoicing or payroll, then move to quarantine and later to reject.

Why does DMARC fail when SPF and DKIM pass?

Because of alignment. DMARC needs SPF or DKIM to pass for a domain that matches the From address. Third-party services often pass SPF and DKIM for their own domain; set them up to sign with your domain, or to use a bounce domain of yours.

Does Scanbe4 check SPF, DKIM and DMARC?

Scanbe4 reports whether an SPF record is published, shows it, and flags changes to it between scans. Its DMARC and DKIM results are not reliable today, so check those two by hand with the commands in this article.

Where to go next

Want to see what your domains expose, from DNS records to certificates? Request a demo.

Filed under Email security · DNS · Brand protection

Related articles

Talk to the team

Scan before
attackers do.

Book a walkthrough and we will run Scanbe4 against your own domains with you.

Request a demoSee pricing

Quoted per organization · Set up with our team