SPF, DKIM, and DMARC: A Practical Setup Guide
SPF, DKIM, and DMARC are public DNS records (and, for DKIM, a signature written into each message) that let a receiving network test whether your domain authorized the mail it is looking at. They do not clean a list and they do not promise inbox placement on their own. They do give Gmail, Yahoo, Outlook.com, and every other filter a way to tell your mail apart from lookalike abuse.
This guide walks through what each record does, how to publish them in a safe order, and how to avoid the mistakes that make “we set up authentication” fail in production. Official definitions come from the RFCs and from the provider help pages linked below.
Once the records exist, read how Gmail and Yahoo apply them in the bulk-sender rules explainer. For how providers judge a domain over time, see the sender standing walkthrough.
Why SPF, DKIM, and DMARC records exist
Email’s original design let anyone put any address in the From field. That convenience is also how phishing works. The three records close different gaps:
- SPF answers “was this message handed off by a host the domain named?”
- DKIM answers “did a holder of the domain’s key sign this content?”
- DMARC answers “does the visible From domain match one of those proofs, and what should a receiver do when it does not?”
Google’s sender guidelines ask for SPF or DKIM on mail into individual Gmail mailboxes, and they ask bulk senders to use all three, with the From domain aligned to SPF or DKIM. Yahoo’s sender requirements follow the same split: SPF or DKIM for everyone, and for large streams both checks plus a DMARC policy that is allowed to begin at none. Microsoft describes comparable expectations for busy senders into Outlook.com consumer brands in its 550 5.7.515 article.
Publishing the records is table stakes for serious sending. It is also how you protect your own brand when someone else tries to impersonate it.
What SPF does
The Sender Policy Framework is specified in RFC 7208. You publish a TXT record on the domain used as the envelope sender (the Return-Path, also called the 5321 Mail From). The record lists mechanisms such as ip4, ip6, include, and a that describe who may send using that envelope domain. A receiver looks up the record, compares it with the connecting IP, and records a pass or fail.
A typical record for a domain that sends only through one email platform looks like this (replace the include with the hostname your platform documents):
v=spf1 include:_spf.your-platform.example ~all
The ~all at the end is a “soft fail.” Receivers treat unmatched IPs as suspicious without instructing them to reject on SPF alone. A hard fail (-all) is stricter and belongs only after you are sure every legitimate sender is listed. Never publish +all, which authorizes the entire internet.
RFC 7208 limits the number of DNS-querying mechanisms in an SPF evaluation to ten, including nested include lookups. If you stack several platforms, each with its own nested includes, the check can void and look like a failure. That cap is the usual reason a “we added one more vendor” change suddenly breaks SPF.
You may publish only one SPF TXT record per name. If two tools each give you a complete v=spf1 … string, merge them into a single record instead of creating two.
Google Workspace documents its own include and setup steps in Set up SPF. Other platforms publish their own includes. Use the document your vendor maintains rather than copying an include from a blog.
What DKIM does
DomainKeys Identified Mail is specified in RFC 6376. Your sending system signs selected headers and the body with a private key. The matching public key lives in DNS at a selector name, such as s1._domainkey.example.com. A receiver fetches that key and verifies the signature. A pass means the content covered by the signature matches what the signer sent.
DKIM survives many forwarding paths that break SPF, because the signature travels with the message instead of depending on the connecting IP. That is why providers lean on DKIM for both authentication and reputation.
Two practical rules matter for consumer inboxes:
- Google requires a DKIM key of at least 1024 bits for mail to personal Gmail accounts and recommends 2048 bits when the DNS host allows it.
- Yahoo states the same floor (1024 bits) and the same 2048-bit recommendation.
If you send through several platforms, give each platform its own selector and key. Google’s Postmaster authentication notes recommend a unique DKIM configuration per third-party service so you can rotate or revoke one vendor without touching the others.
Google Workspace users can follow Turn on DKIM. Everyone else should use the key-generation and DNS instructions their sending platform provides. Do not paste a sample public key from an article into production DNS. The private half has to match, and it has to stay secret.
What DMARC does
Domain-based Message Authentication, Reporting, and Conformance is specified in RFC 7489. You publish a TXT record at _dmarc.example.com. A simple starting record looks like this:
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
The pieces work as follows:
- p= is the policy for mail that fails DMARC: none (monitor only), quarantine (treat as suspicious), or reject (refuse).
- rua= names a mailbox that can receive aggregate reports from participating receivers. Those reports show who is sending as your domain and whether their mail passed.
- Optional tags such as ruf= (failure reports), pct= (a percentage of failing mail to apply the policy to), and adkim / aspf (strict versus relaxed alignment) come later.
Google tells bulk senders that a monitoring policy (none) meets its DMARC requirement. Yahoo says the same, recommends a working rua mailbox during setup, and accepts relaxed alignment. Microsoft’s consumer-mail article also treats p=none as an acceptable starting policy.
DMARC is also how you ask receivers to protect your users from lookalikes. A domain that never sends mail can still publish p=reject so nobody else can send as it. A domain that sends from many tools should stay at p=none until the aggregate reports show that legitimate sources pass.
Google Workspace’s walkthrough is Help prevent spoofing with DMARC. Yahoo’s FAQ includes its own DMARC overview if you want the receiver-side view.
How they work together: alignment
A message can pass SPF for one domain and DKIM for another, while the person sees a third domain in the From header. DMARC calls the match between the From domain and the authenticating domain “alignment.”
- Relaxed alignment (the default) passes when the organizational domains match. Mail from news.example.com can align with a DKIM signature for example.com.
- Strict alignment requires an exact match.
Google’s bulk-sender rule is that the organizational domain shown to the recipient must line up with the domain SPF authenticated or the domain DKIM signed. Yahoo states the same rule and notes that relaxed alignment is acceptable. You do not have to align both SPF and DKIM, but having both pass and at least one align is the resilient setup, because forwarding often breaks SPF while leaving a valid DKIM signature.
This is why changing the visible From address without updating DKIM or SPF causes quiet failures. The platform may still accept the message at SMTP time. DMARC then fails, and the receiving network applies your policy or its own filtering.
Step 1: Inventory every system that sends mail for you
Before you touch DNS, list every tool that can put your domain in an envelope or a From header:
- Your marketing or newsletter platform
- Product mail (receipts, alerts, password resets)
- Help desk and CRM mail
- Billing and invoicing
- Any agency or partner that sends on your behalf
For each row, record the envelope domain, the visible From domain, whether the vendor can sign DKIM as you, and the SPF include or IP ranges they document. Gaps in this list are the usual source of “DMARC reports show unknown senders” later.
If a vendor cannot sign DKIM as your domain and cannot be listed in SPF, that vendor should not use your customer-facing From domain.
Step 2: Publish SPF
- Collect the includes and IP mechanisms from the inventory.
- Draft one v=spf1 record and count the DNS lookups, including nested includes. Stay at or under the limit of ten.
- Publish the record on the envelope domain, not as a second competing TXT record.
- Start with ~all unless you already know the inventory is complete and you have a reason to reject unmatched hosts.
- Wait for DNS to propagate, then send test messages from each system and inspect the Authentication-Results header.
If a lookup would push you over the cap, move some traffic onto a subdomain with its own SPF record (mail.example.com for the platform that blew the budget) rather than chaining more includes on the root.
Step 3: Turn on DKIM
- In each sending platform, generate a key pair and choose a selector name you will recognize later (google, sendgrid1, helpscout, or similar).
- Publish the public key at selector._domainkey.yourdomain.
- Enable signing for the From domain you actually use.
- Prefer a 2048-bit key when the DNS host accepts a record of that size. Use at least 1024 bits to meet Google and Yahoo expectations.
- Send a test from that platform and confirm dkim=pass with the selector you published.
Rotate keys when a vendor relationship ends or when your platform asks you to. Leaving an old public key in DNS after the private key is retired is better than removing it too early, but an unused selector should not linger forever.
Step 4: Publish DMARC at p=none
- Create a mailbox or group that can receive aggregate reports (a dedicated address is easier to filter than a person’s inbox).
- Publish _dmarc with p=none and a rua= target you control.
- If the report destination is on a different organizational domain, follow that domain’s required authorization record so receivers will actually deliver the reports. RFC 7489 describes this check.
- Leave the policy at none while you read at least a few report cycles.
At this stage you are collecting evidence, not blocking anyone. That is the correct first policy for a live sending domain.
Step 5: Read reports and tighten the policy
Aggregate reports arrive as XML (many teams run them through a parsing service). For each source, ask:
- Do we recognize this sender?
- Do the SPF and DKIM checks pass, and does at least one of them match the visible From identity?
- If not, is this a missing include, a vendor that rewrites the message, a forwarder, or actual abuse?
Fix legitimate sources first. When the reports show that your real systems pass and the remainder looks like spoofing, move to p=quarantine for a period, then to p=reject if that matches your risk tolerance. Some transactional setups stay at quarantine because a third-party tool still cannot align. That is an operational choice, not a failure, as long as Google and Yahoo’s minimum of p=none is met and alignment works for the mail you care about.
Google’s Postmaster Tools dashboards note that senders usually see high DKIM and DMARC pass rates when the records are configured correctly, and that SPF success rates tend to be lower and are often related to how many messages third parties send for you. Do not chase a 100 percent SPF pass rate at the cost of breaking a real mailbox path.
Common mistakes
- Two SPF records on the same name, so receivers see an unusable policy
- Crossing the ten-lookup cap after adding “just one more” include
- Signing DKIM as the vendor’s domain while showing your domain in From, so DMARC cannot align
- Publishing DMARC at p=reject on day one and then discovering the billing system was never signed
- Using a 512-bit or otherwise short DKIM key that consumer inboxes will not accept
- Forgetting a subdomain that sends mail and has no records of its own (subdomains inherit DMARC in a specific way, but they do not inherit SPF or DKIM)
- Copying an example record from a guide, including this one, without replacing hostnames and mailboxes
How to check that the records work
- Send yourself messages at a personal Gmail account, a Yahoo account, and an Outlook.com account, then open the full headers and read Authentication-Results
- Use the dig or Check MX functions in Google’s Admin Toolbox (the sender guidelines point senders there) to confirm the published TXT records
- Watch the authentication view in Postmaster Tools once volume is high enough to populate it
- Read DMARC aggregate reports for sources you did not test by hand
A single passed test message is necessary and not sufficient. Each sending system in the inventory needs its own test.
How this ties to inbox placement and list quality
Authentication tells a provider the message is from the domain it claims. It does not tell the provider that the addresses on the list wanted the mail or can still receive it. A domain with tidy records and a file full of dead rows will still collect bounces and complaints. Verify the addresses with kukudze before large sends, and keep the deliverability basics in view alongside this DNS work. Monthly check limits and list sizes are on the pricing page.
FAQ
Are all three records required if I send only a few messages a day?
Google’s baseline for mail into individual Gmail mailboxes is SPF or DKIM, and it recommends all three. Yahoo’s baseline for any sender is also SPF or DKIM. Publishing the full set costs little and means you are ready if volume grows into a bulk or high-volume category. A domain that never sends mail still benefits from a restrictive DMARC policy so others cannot spoof it.
Can I skip SPF if DKIM passes?
You should not. Forwarding can break one check while the other survives. Google and Yahoo both require SPF and DKIM together once they treat you as a bulk sender, even though only one of them must align for DMARC.
What happens if SPF exceeds ten DNS lookups?
RFC 7208 says the evaluation must stop and the result is treated as a permanent error (usually seen as permerror). Receivers then cannot use SPF for that message. Split senders across subdomains or remove unused includes.
Should I jump straight to p=reject?
Not on a domain that already sends from several tools. Start at p=none, repair whatever the reports reveal, then move in steps. Jumping to reject is appropriate for parked domains that should never send.
Does kukudze publish these records for me?
No. SPF, DKIM, and DMARC live in your DNS and at your sending platforms. kukudze checks addresses before you send. The two jobs complement each other; they are not substitutes.
Final thoughts
SPF, DKIM, and DMARC are the DNS records mailbox providers use to decide whether a message is allowed to use your domain. Once SPF, DKIM, and DMARC are in place, keep the list worthy of the domain you just authenticated.
Set the records in order: inventory, SPF, DKIM, DMARC at p=none, then policy tightening guided by reports. Use the RFCs and your vendors’ own setup pages as the source of record syntax, and use provider headers plus Postmaster Tools to prove the records work in the wild.
When the DNS side is in place, keep the list worthy of the domain you just authenticated. Verify upcoming files via the kukudze product page and review the monthly check limits on the pricing page.
Check your list before you send. Try the verifier with one address or a CSV list.
Start verifying