100% Client-Side Privacy: Zero files or data uploaded.
Webmaster & Email Tech

Optimizing Email Deliverability: How to Configure SPF, DKIM, and DMARC TXT Records Without Mistakes

August 28, 2026 • By Muhammad AbuBakar Azam 11 min read • Zero-Data Privacy Verified

Table of Contents

Your emails are not going to spam because of what they say. They are going to spam because the receiving server cannot prove they came from you. SPF, DKIM and DMARC are the three DNS records that provide that proof — SPF lists who may send for your domain, DKIM cryptographically signs each message, and DMARC tells receivers what to do when the first two fail. This guide builds all three records for a real domain, explains the limits that trip people up, and shows how to roll DMARC out to full enforcement without blocking your own mail.

A row of mailboxes on wooden posts
A row of mailboxes on wooden posts Photo: Andreas Duess, CC BY 2.0, via Wikimedia Commons

1. What SPF, DKIM and DMARC Each Do

Think of the three records as three different questions a receiving server asks about every message. SPF (Sender Policy Framework, RFC 7208) asks: is this server allowed to send mail for this domain? It is a TXT record on your domain listing the authorised senders — your mail provider, your website's mail service, any third-party sender — and receivers check the sending IP against it. DKIM (DomainKeys Identified Mail, RFC 6376) asks: is this message intact and really from this domain? Your mail server signs the message with a private key; receivers verify the signature with a public key you publish in DNS. DMARC (Domain-based Message Authentication, Reporting, and Conformance, RFC 7489) asks: what should I do when SPF and DKIM both fail — and where should I send the report? It is the policy record that ties the other two together.

None of the three works alone. SPF without DKIM breaks when mail is forwarded, because forwarding changes the sending IP. DKIM without DMARC proves the message is genuine but tells the receiver nothing to do with a forgery. DMARC without either is an empty policy. And all three are now effectively mandatory for bulk senders: since February 2024, Gmail and Yahoo require SPF, DKIM and DMARC from domains sending 5,000 or more messages a day, and Microsoft joined them on May 5, 2025, rejecting non-compliant mail to Outlook.com, Hotmail and Live.com addresses with error 550 5.7.515. Small senders are not exempt in practice either — receivers increasingly treat missing authentication as a spam signal for everyone.

Record Published as What it proves If it is missing
SPF TXT at your domain This server may send for this domain Receivers cannot verify the sender; spoofing is easy
DKIM TXT at a selector subdomain This message is intact and signed by this domain No tamper-proof signature; forwarded mail looks suspicious
DMARC TXT at _dmarc.yourdomain.com What to do when SPF/DKIM fail; where to report Receivers guess — usually by sending failures to spam

2. The Three Records, Built Step by Step

Take a small business domain, yourdomain.com, sending through Google Workspace, with order emails also sent by an e-commerce platform. The setup has four steps, and the order matters: SPF first, then DKIM, then DMARC at p=none so you can watch the reports before enforcing anything.

Step 1 — SPF. Publish one TXT record at your domain root: v=spf1 include:_spf.google.com include:shops.shopify.com ~all. The v=spf1 declares the version; each include: authorises a provider's sending servers; ~all (softfail) tells receivers to accept but flag mail from anyone else while you are testing. Never use +all, which authorises the entire internet, and never publish two SPF records — receivers only read one, and a second record breaks authentication outright. Count your DNS lookups: SPF allows a maximum of 10, and include, a, mx, ptr, exists and redirect each count. Explicit IP addresses (ip4 and ip6) do not count, which is why SPF flattening — replacing an include with its IP addresses — works, though it can break silently if the provider changes its IPs.

Step 2 — DKIM. In your mail provider, generate a DKIM key pair and publish the public key as a TXT record at the selector subdomain, for example google._domainkey.yourdomain.com, containing v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEB... where the long p= value is your public key. Your provider signs every outgoing message with the private key; receivers fetch the public key and verify the signature. Keep the private key private — anyone with it can sign mail as your domain.

Step 3 — DMARC. Publish a TXT record at _dmarc.yourdomain.com: v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; pct=100. The p=none policy means receivers take no action on failures yet — they just send you aggregate reports at the rua address. Alignment is what DMARC actually checks: the domain in the visible From header must match the domain that passed SPF (the return-path domain) or DKIM (the d= domain). By default alignment is relaxed, so a return-path of bounce.yourdomain.com aligns with a From of yourdomain.com; strict alignment (aspf=s; adkim=s) requires an exact match.

Step 4 — Wait, then tighten. Lower the TTL on the records to 300 seconds before you change anything, then wait out the old TTL window so caching resolvers pick up the short TTL, and only then edit the record. After DMARC is live at p=none, watch the reports for a week or two: they show every source sending as your domain, including the ones you forgot. When the reports show only legitimate senders passing, move to p=quarantine; pct=10, then raise the percentage in steps to 100, then move to p=reject. The pct= tag is the throttle that makes this safe: at pct=10, only a tenth of failing mail gets the policy applied.

3. From Spam Folder to Inbox: A Shop's Rollout

A small online shop selling handmade candles had a familiar problem: order confirmations were landing in customers' spam folders, and a few customers had received fake 'your order is delayed' emails that the shop never sent. The shop's domain had no SPF, DKIM or DMARC records at all — anyone could send mail claiming to be the shop, and receivers had no way to tell the real confirmations from the fakes.

The shop's rollout, week by week:

Week 1 — SPF and DKIM: the shop published an SPF record authorising its mail provider and its e-commerce platform, and enabled DKIM signing. Order confirmations started passing authentication immediately. No visible change for customers yet — but the foundation was in place.

Week 2 — DMARC at p=none: the shop published a DMARC record with p=none and a reporting address. The first reports revealed a surprise: a review-request app the shop had connected a year earlier was sending mail as the shop from its own servers, and failing SPF. The shop added the app to the SPF record instead of discovering the problem by losing its emails.

Weeks 3 to 4 — Quarantine in steps: with the reports clean, the shop moved to p=quarantine at pct=10, then 50, then 100. Forged order emails started going to recipients' spam folders instead of their inboxes. Legitimate mail was unaffected, because it was passing.

Week 5 — Reject: the shop moved to p=reject. Forged mail is now refused outright, and the shop's own confirmations land in the inbox. The whole rollout took five weeks, most of it waiting and reading reports — the actual record changes took minutes.

The moral is the order: monitor before you enforce. A shop that jumps straight to p=reject on day one risks blocking its own order confirmations, invoices, or password resets — the mail it most needs delivered. The reports exist so you can find the forgotten sender before your customers do.

4. Mistakes That Break Authentication

Five mailboxes in front of a green hedge
Five mailboxes in front of a green hedge Photo: Andreas Duess, CC BY 2.0, via Wikimedia Commons

5. Your Go-Live Checklist

Work through this list in order — it is the whole rollout on one page:

  1. List every sender: your mail provider, your website, your shop platform, your review app, your invoicing tool — anything that has ever sent mail as your domain. Check the DMARC reports later for the ones you forgot.
  2. Publish one SPF record: all senders in a single TXT record, ending in ~all while testing. Verify it with a checker and count the lookups — stay under 10.
  3. Enable DKIM signing: generate the key in your mail provider, publish the public key at the selector subdomain, and send a test message to confirm the signature verifies.
  4. Publish DMARC at p=none with a reporting address: set the TTL to 300 seconds first, then read the reports for one to two weeks and fix every legitimate sender that fails.
  5. Tighten in steps: p=quarantine at pct=10, then 50, then 100, then p=reject. At each step, confirm your own mail still arrives. Then re-check quarterly, and every time you add a new sending service.

6. The Bulk-Sender Rules You Cannot Ignore

The three records are no longer best practice — for bulk senders they are the price of admission. Gmail and Yahoo have required SPF, DKIM and DMARC from senders of 5,000 or more messages a day since February 2024, and Microsoft's Outlook.com, Hotmail and Live.com followed on May 5, 2025, rejecting non-compliant mail with 550 5.7.515. The same rules also require a one-click List-Unsubscribe header (RFC 8058) on marketing mail for Gmail and Yahoo, and a reported spam complaint rate under 0.3% — ideally under 0.1%. DNS records alone do not satisfy the bulk-sender rules; authentication, easy unsubscribing and low complaints are all part of the same package.

For everyone else, the direction of travel is the same. Receivers already use missing authentication as a spam signal, and the thresholds only tighten. Setting up SPF, DKIM and DMARC correctly now — and keeping them correct when you add a new tool — is a one-time job that protects every message you will ever send from the domain. The reports keep coming, which is the point: they are a free, permanent audit of who is sending mail as you.

7. Questions People Ask Before Going Live

My mail is already delivered — do I still need DMARC?

Yes, because delivery is not authentication. Without DMARC, anyone can send mail that claims to be from your domain, and receivers have no instruction to stop it. Your own mail may arrive fine while phishing mail in your name arrives just as reliably. DMARC is what lets receivers tell the two apart.

How long do DNS changes take to work?

As long as the TTL says — often minutes with a 300-second TTL, but up to 24 or 48 hours if the old TTL was long. That is why the checklist says to lower the TTL first, wait out the old window, and only then change the record. Test with a DNS checker from several locations before declaring the change done.

What happens if I get the SPF record wrong?

Usually, legitimate mail starts failing authentication and lands in spam — or, if you used +all, nothing changes and you have no protection at all. The safe path is ~all while testing, the DMARC reports to catch mistakes, and a checker to validate the record before and after every edit.

8. The Short Version

SPF lists who may send for your domain, DKIM proves each message is genuine and intact, and DMARC tells receivers what to do when both fail. Publish one SPF record, enable DKIM signing, then roll DMARC out in steps — none, quarantine, reject — reading the reports at each stage. The whole job takes an afternoon of work and a few weeks of watching; the protection lasts as long as the domain does.

Keep these three habits and your mail stays out of the spam folder:

Build your records with the Email Deliverability DNS Generator: it produces the SPF, DKIM and DMARC TXT records for your domain and providers, ready to paste into your DNS — and then run them through a checker before you publish.

Interactive Utility

Generate SPF, DKIM & DMARC Records

Use our 100% private, client-side utility to perform instant calculations in your browser.

Launch Free Tool

Frequently Asked Questions

Detailed answers about SPF, DKIM and DMARC setup.

What do SPF, DKIM and DMARC each do?
SPF (RFC 7208) lists which servers may send mail for your domain. DKIM (RFC 6376) cryptographically signs each message so receivers can verify it is intact and genuinely from your domain. DMARC (RFC 7489) tells receivers what to do when SPF and DKIM fail — nothing, quarantine, or reject — and where to send reports. You need all three; each one covers a failure the others cannot.
Why are my emails going to spam?
Most often because the receiving server cannot authenticate them: no SPF record, no DKIM signature, or a DMARC failure. Check authentication first with a mail tester, then check the other bulk-sender requirements — a one-click unsubscribe header, a spam complaint rate under 0.3%, and content that does not look like the mail receivers have learned to distrust.
How long does it take for SPF, DKIM and DMARC changes to work?
As long as the TTL on the records — usually minutes with a 300-second TTL, but up to 24 to 48 hours if the old TTL was long. Lower the TTL before changing a record, wait out the old TTL window, then make the change, and verify with a DNS checker from more than one location.
Can I have two SPF records for my domain?
No. A domain may have only one SPF record; publishing two causes an error and receivers treat it as if there were no SPF at all. If you use several sending services, combine all of them into a single TXT record, and keep the total DNS lookups under the 10-lookup limit.
What does a DMARC policy of p=reject actually do?
It tells receiving servers to refuse mail that fails DMARC authentication outright, instead of delivering it to the spam folder or the inbox. It is the strongest protection against spoofing — but only use it after a monitoring period at p=none and a staged rollout through p=quarantine, so you know your own legitimate mail passes first.

Trusted Resources