Skip to main content
Academy · Module 11 of 12

Setting up SPF, DKIM and DMARC

The records themselves, for Google Workspace and Microsoft 365: what to publish, where, and in what order. Plus the mistakes that quietly break authentication: two SPF records, too many lookups, unaligned DKIM and a rushed DMARC policy.

15 min read · Course overview

Objectives

In this module

  • Explain which identity SPF, DKIM and DMARC each check, and what alignment means in practice.
  • Write an SPF record for Google Workspace or Microsoft 365 and keep it within the lookup limit.
  • Publish DKIM for each service that sends as your domain.
  • Roll DMARC from monitoring to enforcement without blocking your own mail.
  • Verify the result from a real message's headers.
11.1

Three records, two identities

Every email carries two sender identities. The envelope sender (MAIL FROM, which ends up as the Return-Path) is what servers use during delivery and what SPF checks [1]. The header From: is what the recipient sees. DKIM signs the message with a private key whose public half you publish in DNS under a selector [2]. DMARC then asks whether a passing SPF or DKIM result belongs to the same domain as the visible From: [3]. That match is called alignment, and it's the part most setups get wrong.

Alignment is relaxed by default, so mail.example.com aligns with example.com; strict mode (adkim=s, aspf=s) requires an exact match [3]. A message passes DMARC when either SPF or DKIM passes and aligns [3]. In practice DKIM is the one to rely on: SPF breaks when mail is forwarded, and many sending platforms use their own Return-Path domain, which passes SPF without aligning.

11.2

SPF: one record, ten lookups

An SPF record is a TXT record on the domain that starts with v=spf1, lists who may send, and ends with an all mechanism. Google's record for a domain that sends only through Workspace is v=spf1 include:_spf.google.com ~all [4]. Microsoft's for a domain that sends only through Microsoft 365 is v=spf1 include:spf.protection.outlook.com -all [7]. When several services send for you they share one record; Google's example for Workspace plus Microsoft 365 is v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all [4].

The two vendors disagree on the ending. Google recommends ~all, a soft fail [4]. Microsoft recommends -all, a hard fail, so DMARC can act on messages that fail SPF even when they carry no DKIM signature [7]. Once DMARC is enforcing either works; what matters is that every legitimate sender is listed. The mistakes that break SPF are few and common:

  • Two SPF records. A domain must not publish more than one; if it does, SPF returns a permanent error for every message [1,7]. Adding a service means editing the existing record, not adding another.
  • Too many lookups. The include, a, mx, ptr and exists mechanisms and the redirect modifier each cost a DNS lookup during evaluation, and more than 10 is a permanent error [1]. Includes inside includes count too. The ip4 and ip6 mechanisms don't [1].
  • Void lookups. An include pointing at a name that returns nothing counts as a void lookup, and the RFC recommends treating more than two as a permanent error [1]. Remove entries for services you no longer use.
  • Subdomains. The record on example.com doesn't cover mail.example.com; every subdomain that sends needs its own [7].
  • Domains you never send from. Publish v=spf1 -all on them so nobody can pass SPF while pretending to be you [7].
11.3

DKIM: a key for every sending service

DKIM publishes a public key at selector._domainkey.yourdomain, and the sending service signs each message with the matching private key [2]. Every service that sends as your domain (your mailboxes, your CRM, your newsletter tool) needs its own DKIM setup with its own selector, signing as your domain rather than its own.

In Google Workspace you generate the key in the Admin console under Gmail's Authenticate email settings. Choose a 2048-bit key if your DNS host supports it, keep the default selector google, publish the TXT record at google._domainkey, then come back and click Start authentication [5]. Google notes that after turning on Gmail you may wait 24–72 hours before you can generate the key, and that DKIM can take up to 48 hours to start working after you publish it [5].

Microsoft 365 uses two CNAME records instead, selector1._domainkey and selector2._domainkey, which point at keys Microsoft hosts so it can rotate them [8]. Copy the exact values from the DKIM tab of Email authentication settings in the Defender portal, publish both CNAMEs, then turn on Sign messages for this domain with DKIM signatures [8]. Until you do, Microsoft does not DKIM-sign mail from custom domains at all [8].

  • Doubled host names. Many DNS hosts append your domain automatically, so typing google._domainkey.example.com creates google._domainkey.example.com.example.com. If yours does, enter only the part before your domain.
  • Long keys. A 2048-bit key is long, and some DNS hosts limit TXT record length; Google's DKIM guide covers what to do if yours does [5].
  • Platform signatures. A tool that signs as d=its-own-domain passes DKIM but doesn't align with your From:. Set up the custom-domain DKIM records the service gives you.
  • Parked domains. Don't publish DKIM records for domains you never send from [8].
11.4

DMARC: monitor, then enforce

DMARC is a TXT record at _dmarc.yourdomain. Start in monitoring mode with a reporting address: v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com. Google recommends starting at none and always including rua [6], and Microsoft recommends the same gradual path from none to quarantine to reject [9]. Without a rua tag, receivers won't send you aggregate reports at all [3].

The aggregate reports are XML files listing every source that sent as your domain and whether each passed SPF, DKIM and alignment. Read them for a few weeks; a DMARC report service makes them readable. Every legitimate source that fails, such as a billing system, help desk or newsletter tool, needs fixing before you tighten the policy, or your own mail will be junked or rejected.

Older guides, including Google's and Microsoft's own setup pages, ramp enforcement with the pct tag, such as pct=10 rising to pct=100 [6,9]. The current DMARC standard, RFC 9989 (May 2026), removed pct because receivers applied values other than 0 and 100 inconsistently, and added t=y as an explicit test-mode flag [3]. A record that still contains pct isn't broken, but don't count on a percentage rollout behaving as written. Move the policy in whole steps and watch the reports after each.

A rollout, record by record (illustrative timing)
_dmarc.example.com  TXT

Week 0    v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
          read the reports; fix every legitimate source that fails
Week 4+   v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
Week 8+   v=DMARC1; p=reject; rua=mailto:dmarc-reports@example.com

Optional tags: sp= for existing subdomains, np= for subdomains that
don't exist, and t=y to ask receivers not to apply the policy yet.
11.5

Checking your work

DNS lookups prove a record exists, not that mail passes. Send a test message from each service to a Gmail address and open Show original, which lists the SPF, DKIM and DMARC results for that message. In the full headers, the Authentication-Results line shows which domain passed each check, and the d= value in the DKIM-Signature shows which domain signed [2]. You want to see:

  • SPF: pass, for a Return-Path domain that matches your From: domain or is a subdomain of it.
  • DKIM: pass, with d= your domain rather than the platform's.
  • DMARC: pass. If it says fail while SPF and DKIM both pass, neither of them aligned.
  • The same for every service that sends as your domain, not only your own mailbox.
11.6

Why it is worth finishing

Bulk senders to Gmail must publish DMARC and align the From: domain [10], and Microsoft requires domains sending more than 5,000 emails a day to Outlook.com addresses to pass SPF and DKIM and publish DMARC [11]. Even below those volumes, a domain with aligned DKIM and an enforced DMARC policy is far harder to spoof, and spoofed mail in your name is reputation you didn't spend.

Key takeaways

Remember this

  • SPF checks the envelope sender, DKIM signs the message, and DMARC checks both against the visible From:.
  • Publish one SPF record per domain and keep it within ten DNS lookups.
  • Every service that sends as you needs its own aligned DKIM.
  • Start DMARC at p=none with rua, fix every failing source, then enforce in whole steps.
  • Verify with real test messages, not just DNS lookups.
Exercise

Inventory your senders

Do this before you change any record.

  1. Step 1

    List every system that sends email as your domain: mailboxes, CRM, billing, help desk, newsletter, outreach tools and website forms.

  2. Step 2

    Look up the domain's current SPF record and count its DNS lookups, including the ones inside each include.

  3. Step 3

    For each sender, send yourself a test and confirm DKIM signs with your domain (d=) and DMARC passes.

  4. Step 4

    Publish or update DMARC at p=none with a rua address, and set a date four weeks out to review the reports.

  5. Step 5

    Publish v=spf1 -all on every domain you own but never send from.

Try it now

Build and check your records

Generate SPF and DMARC records from the services that send as you, then check what the domain publishes today.

In AngelSend

Where this lives in the product

Records for each sending domain

When you add a sending domain on the Domains page, AngelSend lists the records to publish (ownership TXT, SPF, the provider's DKIM and return-path, and DMARC) and checks them when you click Verify. A campaign can't send from an unverified domain.

Your own mailbox

Connect Gmail or Outlook and outreach goes out through your own mailbox, so it is signed by the DKIM you set up in Google Workspace or Microsoft 365.

Free record tools

The SPF and DMARC record generator builds records from the services that send as you, and the deliverability checker looks up a domain's MX, SPF, DKIM and DMARC in one step.

Check yourself

Quiz

Pick an answer to see the explanation.

  1. Q1A domain publishes two TXT records that start with v=spf1. What happens?

  2. Q2Which of these does not count toward SPF's 10-lookup limit?

  3. Q3SPF and DKIM both pass, but DMARC fails. What is the most likely cause?

  4. Q4Why move DMARC enforcement in whole steps instead of relying on pct?

Sources

  1. [1]RFC 7208: Sender Policy Framework (SPF) — IETF
  2. [2]RFC 6376: DomainKeys Identified Mail (DKIM) Signatures — IETF
  3. [3]RFC 9989: DMARC — IETF
  4. [4]Set up SPF — Google
  5. [5]Set up DKIM — Google
  6. [6]Set up DMARC — Google
  7. [7]Set up SPF to identify valid email sources for your Microsoft 365 domain — Microsoft Learn
  8. [8]How to use DKIM for email in your custom domain — Microsoft Learn
  9. [9]Set up DMARC to validate email in Microsoft 365 — Microsoft Learn
  10. [10]Email sender guidelines — Google
  11. [11]Strengthening Email Ecosystem: Outlook's New Requirements for High-Volume Senders — Microsoft

This course summarizes published rules, regulator guidance and third-party research as of November 2026. It is not legal advice; check with counsel before emailing into a jurisdiction. Vendor benchmark figures are each vendor's own data and definitions.

Practice on
your own outreach.

Start with a $3.99 Starter Pack — no subscription required.

Starter pack from $3.99 · CAN-SPAM compliant · Reputation protected