Field guide

SPF, DKIM and DMARC: stop your domain being spoofed, and keep your mail out of spam.

To stop your domain being spoofed, publish one SPF record, sign mail with DKIM for every sender, and publish a DMARC record that starts at p=none with reporting. Once the reports show every legitimate sender passing, move to quarantine and, where it fits, reject. This guide covers the order, the records and the mistakes that bite.

What SPF, DKIM and DMARC do, and how they fit together

The short answer: SPF says which servers may send for your domain, DKIM proves a message was signed by your domain and not altered, and DMARC tells receivers what to do when neither check lines up with the address people see. You need all three; DMARC is the one that changes what receivers do with forged mail.

SPF is a DNS record listing the hosts allowed to send mail using your domain. A receiver checks the connecting server against it (RFC 7208). It checks the envelope sender, not the From address in the mail client.

DKIM adds a cryptographic signature to each message. The public key lives in DNS under a selector, at selector._domainkey.example.com, so one domain can publish several keys at once (RFC 6376, sections 3.1 and 3.6.2.1). The signature survives forwarding that would break SPF, though not edits such as a mailing list's footer.

DMARC ties the two to the visible From domain. A message passes DMARC if SPF or DKIM passes and the domain it authenticated is aligned with the From domain. Passing either one is enough, and in relaxed mode mail.example.com aligns with example.com (RFC 9989, section 4.4). Alignment is the idea people miss: SPF can pass for your email provider's domain and still say nothing about yours.

Step 1: list every system that sends as your domain

Many DMARC projects stall here, not in DNS. Before touching a record, list every service that sends mail with your domain in the From address: your mailbox provider, the marketing platform, the invoicing tool, the helpdesk, the CRM, the website's contact form, the alert emailer, and the script nobody remembers. Ask finance and sales, not just IT.

Step 4 will surface senders you missed; our post on forgotten assets covers the same problem from the outside.

Step 2: publish one SPF record and stay within 10 lookups

SPF is a single TXT record at the domain apex. Replace the include name below with the one your provider documents:

example.com. IN TXT "v=spf1 include:_spf.mailprovider.example include:spf.marketing.example ~all"

Publish exactly one SPF record. A domain must not have more than one, and if a receiver finds two it returns permerror rather than choosing (RFC 7208, sections 3.2 and 4.5). When you add a vendor, merge its include: into the existing record. Never add a second one.

Stay within ten DNS lookups. The terms include, a, mx, ptr, exists and the redirect modifier each trigger a lookup, and nested includes count. Exceed ten and the result is permerror; ip4, ip6 and all cost nothing (section 4.6.4). Each SaaS include often hides lookups of its own, so a short record can still fail. Drop services you no longer use.

Choose the ending deliberately. ~all (softfail) marks unlisted senders as suspicious; -all (fail) asks receivers to reject them. Some receivers act on an SPF fail before DMARC runs, so -all can reject forwarded mail that DKIM would have rescued, and those rejections never show up in your DMARC reports (RFC 9989, section 7.1). That is why ~all is usual on domains that send mail and -all on domains that send none.

Step 3: turn on DKIM for each sender

DKIM is configured per sender, and each service gives you either a TXT record to publish or a CNAME that points at keys it hosts. The records look like this, with the public key replaced by the one your service generates:

s1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=REPLACE_WITH_PUBLIC_KEY_FROM_YOUR_SENDER"

Use 2048-bit RSA keys where the service offers them. The standard requires signers to use at least 1024 bits for long-lived keys (RFC 6376, section 3.3.3), so 2048 is a margin rather than a mandate. A 2048-bit key exceeds the 255-character DNS string limit, so it is published as two quoted strings in one record; most control panels split it for you, and a silently truncated key is a classic cause of failures.

Plan rotation from the start: publish the new key under a new selector, switch the sender to it, and remove the old record after a reasonable interval. RFC 6376 advises against reusing a selector (sections 3.1 and 5.2).

Step 4: publish DMARC at p=none and read the reports

DMARC is a TXT record at _dmarc. Start in monitoring mode, which changes nothing about delivery:

_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

The rua address receives daily aggregate reports from the receivers that support them, as XML. If that mailbox is on a different organisational domain from the one being protected, the receiving domain must publish a record at example.com._report._dmarc.otherdomain.example beginning with v=DMARC1, or the reports never arrive (RFC 9990, section 4). Most teams use a reporting service, because raw XML is miserable to read at 2 a.m.

Stay at p=none for at least a month (RFC 9989, section 7.4), enough to cover a month-end invoice run. In the reports, look for sources that send as your domain and fail. Each is either a legitimate sender you forgot (fix its SPF or DKIM) or someone spoofing you.

Step 5: move to quarantine, and to reject where it fits

When legitimate mail is passing consistently, raise the policy one step at a time:

_dmarc.example.com. IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"

Watch the reports and your support inbox for at least as long, then decide whether p=reject suits the domain. At reject you ask receivers to refuse failing mail. RFC 9989 tells receivers not to reject on the policy alone, so the effect depends on each receiver.

Caution: RFC 9989 says domains whose staff post to mailing lists should not publish p=reject, because mailing lists and forwarders break SPF and often DKIM (section 7.4). For such domains, quarantine may be the sensible end state. Reject fits transactional or no-mail domains best.

A word on pct=. RFC 7489 let you apply a policy to a percentage of failing mail. Its replacement, RFC 9989 (May 2026), obsoletes RFC 7489 and RFC 9091, drops pct, and moves reporting to RFC 9990 and RFC 9991. Do not rely on intermediate pct values: RFC 9989 records that receivers applied them inconsistently. If you want a test step, publish t=y, which RFC 9989 treats as analogous to pct=0. Moving up one policy level at a time, with reports in hand, is the dependable method.

What Gmail, Yahoo and Microsoft actually require

Google asks all senders to set up SPF or DKIM, have valid forward and reverse DNS, use TLS, and keep the spam rate in Postmaster Tools below 0.3%. For senders of more than 5,000 messages a day to Gmail addresses it also requires SPF, DKIM and a DMARC record, with the From domain aligned with the SPF or DKIM domain, plus one-click unsubscribe for marketing mail. Google says the DMARC policy can be none (Google sender guidelines).

Yahoo requires SPF or DKIM from every sender. Bulk senders need both, a DMARC policy of at least p=none that passes, alignment of the From domain with SPF or DKIM, and one-click unsubscribe honoured within two days. Yahoo strongly recommends a rua tag. Its page does not define the bulk threshold (Yahoo sender best practices).

Microsoft applies its requirements to Outlook.com consumer domains for senders of more than 5,000 emails a day: SPF and DKIM must pass, and a DMARC record of at least p=none must align with one of them. Since 5 May 2025, Outlook.com rejects non-compliant mail from such domains with the error 550 5.7.515 (Microsoft first announced routing to Junk, then changed this to rejection; see the Microsoft announcement).

None of the three requires p=reject. A policy of none keeps you inside the published minimums; it just does not stop spoofing.

Subdomains and domains that send no mail

A DMARC record at the apex covers subdomains too, unless you set sp=, which gives subdomains their own policy, and np=, which covers non-existent subdomains (RFC 9989, section 4.7). That lets you enforce on the main domain while a legacy subdomain is still being cleaned up: p=reject; sp=none, or the reverse.

Domains that never send mail are the easiest win. Attackers can use them because they are often left unprotected. Parked domains, old brand names and defensive registrations need three records, plus one authorisation record if reports go to another domain:

parked.example. IN TXT "v=spf1 -all"

_dmarc.parked.example. IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com"

*._domainkey.parked.example. IN TXT "v=DKIM1; p="

parked.example._report._dmarc.example.com. IN TXT "v=DMARC1;"

The DKIM record publishes an empty key, which RFC 6376 defines as a revoked key. The last record is the authorisation record, published in the zone of the domain that receives the reports, example.com here (RFC 9990, section 4). Together they say that nothing legitimate sends from here. If the domain also receives no mail, a null MX record, parked.example. IN MX 0 ., says so (RFC 7505, section 3).

MTA-STS, TLS-RPT and BIMI in brief

These protect different things. DMARC protects your name; MTA-STS protects mail sent to you from being downgraded off TLS. You publish a TXT record, _mta-sts.example.com with v=STSv1; id=..., and a policy file at https://mta-sts.example.com/.well-known/mta-sts.txt listing your MX hosts and a mode of testing, enforce or none (RFC 8461). Start in testing. TLS-RPT adds reports on failures, via a TXT record at _smtp._tls.example.com such as v=TLSRPTv1; rua=mailto:tls-reports@example.com (RFC 8460).

BIMI shows your logo beside authenticated mail. It requires an SVG Tiny PS logo, with DMARC enforcement (quarantine or reject) on the organisational domain and its subdomains. A verified certificate is optional, but support without one is limited (BIMI Group).

Common mistakes that break mail

Two SPF records. Usually a vendor's setup guide said "add this TXT record". The result is permerror for every message. Merge them.

Forgetting a sender. The newsletter tool, the billing system, or the old server that sends password resets. That is why you read reports for a month or more first, and why a strict policy on day one leaves invoices undelivered.

Passing SPF without alignment. A vendor using its own return-path domain can pass SPF yet fail DMARC. Set up its DKIM with your domain.

Assuming forwarding is harmless. Forwarded mail usually fails SPF, and DKIM is what carries it through.

Treating DMARC as set-and-forget. Every new SaaS tool is a new sender. Keep reading the reports.

Check what you have published

Our Email Auth tool reads the public DNS records for SPF, DKIM (common selectors), DMARC and MTA-STS for a domain, and sends no email. It is a passive DNS lookup: it only finds selectors it tries and cannot see what your senders do. For raw records, use DNS Lookup; DNSSEC to check the zone is signed; and blocklists if mail lands in spam despite correct records. The tool flags ~all as a warning. On a domain that sends mail, that can be a deliberate choice, as explained above.

Spoofed mail features in any ransomware readiness checklist. For a deeper, repeatable look, the Email Security engine covers SPF, DKIM and DMARC, MTA-STS, DNSSEC and BIMI, plus phishing-kit indicators, passively, at $869 per scan.

Frequently Asked Questions

Do I need DMARC if I already have SPF?

Yes. SPF checks the envelope sender, not the From address people see, so on its own it does not stop someone forging your visible domain. DMARC adds the alignment check and tells receivers what to do on failure. Google, Yahoo and Microsoft also expect a DMARC record from high-volume senders.

What is the difference between SPF, DKIM and DMARC?

SPF lists the servers allowed to send for a domain. DKIM signs messages so receivers can verify the domain and detect alteration. DMARC requires that at least one of them passes and aligns with the From domain, and sets the policy for failures.

Should I use p=none, quarantine or reject?

Start at p=none with a rua address and read the reports. Move to quarantine once every legitimate sender passes, and to reject only where it fits, such as transactional or no-mail domains. Domains whose staff use mailing lists may be better off staying at quarantine, and none meets the minimum Google, Yahoo and Microsoft publish for bulk senders.

Why does my SPF record say permerror?

The usual causes are two SPF records on the same domain, or more than ten DNS lookups once include chains are expanded. Both are defined in RFC 7208 and both fail the check outright. Merge the records and remove vendors you no longer use.

Do I need DMARC for a domain that sends no email?

It is worth having. Publish v=spf1 -all, a DMARC record with p=reject, and optionally an empty DKIM key at a wildcard selector. That asks receivers to reject anything claiming to come from the domain, and the report address shows attempts. If reports go to another organisational domain, add the authorisation record described above.