Sign inStart for $1

DeliverabilityPublished 2026-10-19Sources checked 2026-10-19By ColdAgentAI

SPF, DKIM and DMARC explained

SPF says which servers may send for a domain, DKIM signs each message so a receiver can check it was not altered, and DMARC tells receivers what to do when neither check lines up with the address in the From header. Gmail and Yahoo both ask for authentication on mail sent to them, and all three records are cheap to publish. The sections below explain each one, the mistakes that break them, and a worked example you can adapt.

#What each record does

The three records answer three different questions. They are published in DNS, so any receiving server can look them up while the message is arriving.

RecordQuestion it answersWhere it livesWhat is checked
SPFIs this server allowed to send for this domain?A TXT record at the domainThe connecting IP address against the list in the record
DKIMWas this message signed by the domain it claims, and is it unchanged?A TXT record at selector._domainkey.domainA signature in the message header against a public key in DNS
DMARCDoes the visible From domain match an authenticated domain, and what should happen if not?A TXT record at _dmarc.domainWhether SPF or DKIM passed with a matching domain, then the published policy

SPF and DKIM are older and each works alone. DMARC builds on both: RFC 7489 says a message satisfies the DMARC checks if at least one of the supported mechanisms produces a pass result, and does so on an identifier that is in alignment. One passing and aligned check is enough, so you do not need both to align, although publishing both is the safer setup.

#SPF: who may send

An SPF record is a list of the sources allowed to send mail for a domain, written as terms such as ip4:, include:, a and mx, and ending in a rule for everything else. The standard, RFC 7208, defines four qualifiers that can precede a term: + for pass, - for fail, ? for neutral and ~ for softfail. A record that ends in ~all says "anything not listed is suspicious", and one that ends in -all says "anything not listed should fail".

Two rules cause most SPF failures. The first is that a domain may have only one SPF record: the RFC states that multiple SPF records are not permitted for the same owner name, and a receiver that finds more than one returns a permanent error. If you add a second sending service, merge it into the existing record instead of publishing another.

The second is the ten-lookup limit. The RFC says implementations must limit the terms that cause DNS queries, namely include, a, mx, ptr, exists and the redirect modifier, to ten during evaluation, and must return a permanent error if the limit is exceeded. The terms ip4, ip6 and all do not cost a lookup. Lookups also add up inside included records, so a long chain of include: entries can cross the limit even when your own record looks short.

Here is the arithmetic for a made-up record, v=spf1 include:_spf.a.example.net include:_spf.b.example.net mx a ~all. At the top level that is two include terms, one mx and one a, which is 4 lookups. If each included record itself contains two more include terms, that adds 2 times 2 = 4 more, for 8. The mx term also counts the number of MX records it queries towards the limit, so a domain with three MX hosts adds more. A record can therefore reach or pass ten without looking large. When it does, remove services you no longer use, or replace include: terms with ip4: ranges where the sender publishes stable addresses.

DMARC uses the SPF result for the domain in the SMTP MAIL FROM command (the envelope sender, also called the return-path), not the From address a person sees, as RFC 7489 explains. That is why alignment matters.

#DKIM: a signature on each message

With DKIM, the sending system adds a DKIM-Signature header to each message. The header names the signing domain in a d= tag and a selector in an s= tag, and carries a hash of the body in bh= and a signature in b=. The receiver looks up the public key at the name built from those two tags. RFC 6376 says all keys live under a subdomain named _domainkey, so a signature with d=example.com and s=s1 points to s1._domainkey.example.com.

Selectors let one domain hold several keys at once. The RFC suggests they could name offices, dates or even individual users. In practice you give each sending system its own selector, so that you can rotate or remove one without touching the others. An empty p= value in the key record means the key has been revoked, which is the clean way to retire a selector.

Key size matters. The RFC says signers must use RSA keys of at least 1024 bits for long-lived keys, and verifiers must be able to validate keys from 512 to 2048 bits. Google's sender guidelines go further: sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer, and Google recommends 2048 bits where your provider supports it. Yahoo's sender requirements also give 1024 bits as the minimum. A practical rule is to create 2048-bit keys unless your DNS host cannot store the long record, and never go below 1024.

Because the signature carries a hash of the body and of the signed headers, any system that changes those parts after signing, such as one that adds a footer, can make verification fail even though the original sender did nothing wrong. Keep tracking links and footers inside the message before it is signed, not added by a later hop.

#DMARC: alignment, policy and reports

DMARC adds the idea of alignment. A pass from SPF or DKIM only counts if the domain it authenticated matches the domain in the visible From address. RFC 7489 defines two modes. In relaxed mode, the organizational domains must be equal, so a DKIM signature with d=example.com aligns with a From address at news.example.com. In strict mode only an exact match counts. Both adkim and aspf default to relaxed.

The policy tag p= tells receivers what you want done with mail that fails the check. The three values are none, which requests no specific action, quarantine, which asks receivers to treat failing mail as suspicious, for example by placing it in the spam folder, and reject, which asks them to reject it. It is a request, and receivers decide how to act on it.

The rua tag is where DMARC earns its keep. It names an address for aggregate reports, which show which sources are sending as your domain and whether they pass. A policy of none with a rua address is the standard first step: it changes nothing about delivery, and the reports show you every system that sends for you, including ones you forgot. Once those all pass and align, you can move to quarantine and then reject. The optional pct tag, a number from 0 to 100, lets you apply a stricter policy to a share of failing mail while you gain confidence.

Google and Yahoo have made this practical. Google says that senders of more than 5,000 messages a day to Gmail must publish SPF, DKIM and DMARC and that the DMARC enforcement policy can be set to none. Yahoo says bulk senders must publish a valid DMARC policy with at least p=none, and strongly recommends a rua tag. Both ask all senders for at least SPF or DKIM. Read the detail in our guide to the Google and Yahoo bulk sender rules.

#Worked example for example.com

The records below use the reserved names example.com and example.net, so none of this is a live configuration. The sending service is invented. Replace the values with the ones your provider gives you.

DNS records for example.com, annotated
; SPF: one record at the domain. Allows the invented service named in the include, plus the MX hosts.
example.com.                     IN TXT "v=spf1 include:_spf.sender.example.net mx ~all"

; DKIM: selector "s1" holds the public key. p= is the base64 key, shortened here.
s1._domainkey.example.com.       IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...shortened..."

; DMARC: monitor first. p=none changes nothing about delivery; rua says where aggregate reports go.
_dmarc.example.com.              IN TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
  1. Publish the SPF record first. Check that the domain has exactly one record that starts with v=spf1.
  2. Turn on DKIM signing in your sending system, publish the key it gives you at the selector name, and send a test message to a mailbox you control.
  3. Open the received message's headers and confirm that SPF and DKIM both show a pass and that the signing domain matches your From domain.
  4. Publish the DMARC record with p=none and a rua address you read.
  5. Review the aggregate reports for a few weeks, fix any source that fails or does not align, then move to quarantine with a partial pct, and later to reject if you want it.

You can generate the SPF and DMARC strings with our free SPF generator and DMARC generator, and read back what a domain publishes with the domain checker.

#Quick diagnostic table

When a message fails authentication, the symptom usually points at one cause. Use this table to find the likely one and the fix.

SymptomLikely causeFix
SPF shows permerrorMore than one SPF record, or more than ten lookup termsMerge into a single record, and remove unused include: terms
SPF passes but DMARC failsThe envelope domain is different from the From domain, so SPF is not alignedAlign the return-path domain, or rely on an aligned DKIM signature
DKIM shows no key foundWrong selector, or the record was published at the wrong nameCheck the name is selector._domainkey.domain and the selector matches s=
DKIM fails after workingThe message body or signed headers were changed in transit, or the key was revokedTest a direct send, and check the key record's p= is not empty
Key rejected or flaggedKey shorter than 1024 bitsCreate a 2048-bit key and publish it under a new selector
No DMARC reports arriveNo rua tag, a mistyped address, or no volume yetFix the rua address and give receivers a day or two to send reports
Mail to Gmail is rejected with a 5.7.26 errorThe message is not authenticated as Google requiresFix SPF or DKIM, and for bulk senders add DMARC

Google notes that messages which are not authenticated may be marked as spam or rejected with a 5.7.26 error. For the wider picture of why authentication alone is not enough, see our guide to improving cold email deliverability.

#Frequently asked questions

Do I need SPF, DKIM and DMARC all together?

For small volumes, Google asks senders for SPF or DKIM, and Yahoo asks for the same minimum. Bulk senders need all three at both providers. Publishing all three on every sending domain is the simplest rule, since DMARC only works on top of the other two.

What is the SPF ten-lookup limit?

RFC 7208 says the terms that trigger DNS queries (include, a, mx, ptr, exists and redirect) must be limited to ten per evaluation, and exceeding it produces a permanent error. The ip4, ip6 and all terms do not count. Lookups inside included records count too.

Should I start DMARC at reject?

Starting at p=none with a reporting address is safer. It changes nothing about delivery and shows which systems send as your domain. Move to quarantine and reject only after those systems pass and align. Both Google and Yahoo accept p=none for bulk senders.

How long should a DKIM key be?

At least 1024 bits, which both Google and Yahoo name as the minimum, and 2048 bits where your DNS host can store it. RFC 6376 says signers must use RSA keys of at least 1024 bits for long-lived keys.

#Sources

  1. RFC 7208, Sender Policy Framework (SPF)Read 2026-10-19. One SPF record per owner name, four qualifiers, and the ten-lookup limit with the terms that count.
  2. RFC 6376, DomainKeys Identified Mail (DKIM) SignaturesRead 2026-10-19. Selectors, the _domainkey namespace, the 1024-bit minimum for long-lived keys, and revocation by an empty p= value.
  3. RFC 7489, DMARCRead 2026-10-19. Alignment modes, the none, quarantine and reject policies, the rua and pct tags, and the pass-and-aligned rule.
  4. Email sender guidelines, Gmail HelpRead 2026-10-19. SPF or DKIM for all senders, SPF, DKIM and DMARC above 5,000 messages a day, 1024-bit DKIM minimum, 5.7.26 rejection.
  5. Sender Best Practices, Yahoo Sender HubRead 2026-10-19. SPF or DKIM at minimum, bulk senders need both plus a DMARC policy of at least p=none, rua recommended, 1024-bit DKIM key.

In ColdAgentAI

SPF, DKIM and DMARC checks and caps that keep volume steady.

Free tools for this topic: