In one sentence: SPF defines which servers are allowed to send email for your domain. If a server isn't on the list, the email fails.
What is SPF?
SPF is a DNS TXT record that lists the IP addresses and mail servers authorized to send email from your domain. When a receiving mail server gets an email claiming to be from your domain, it checks your SPF record to verify the sending server is authorized.
How SPF works
- Receiving server extracts the sender's domain from the email envelope (MAIL FROM)
- Server queries DNS for the domain's SPF record
- Server compares the sending IP address against authorized IPs in the SPF record
- Server returns Pass, Fail, SoftFail, Neutral, or TempError result
- Receiving server decides whether to accept, reject, or flag the message
✓ Basic SPF record example
v=spf1 ip4:192.0.2.0/24 include:_spf.google.com include:spf.protection.outlook.com ~all
SPF record breakdown
- v=spf1 — Version identifier (always starts with this)
- ip4:192.0.2.0/24 — Authorizes specific IPv4 address range
- include:_spf.google.com — Authorizes Google Workspace mail servers
- include:spf.protection.outlook.com — Authorizes Microsoft 365 (Defender) mail servers
- ~all — SoftFail for all other servers (recommended for initial deployment)
- -all — HardFail for all other servers (use after testing)
✓ Complete SPF record for multiple services
DNS TXT Record — example.com
v=spf1 ip4:203.0.113.10 include:spf.protection.outlook.com include:_spf.salesforce.com include:_spf.hubspot.com -all
⚠ SPF record limitations
SPF has a 10 DNS lookup limit. Each "include" mechanism counts as one lookup. Exceeding this limit causes SPF to fail silently — one of the most common issues we find in audits. Use IP addresses directly where possible and consolidate include statements. Consider SPF flattening tools for complex configurations.
In one sentence: DKIM adds a cryptographic signature to your emails that proves they came from your authorized servers and weren't modified in transit.
What is DKIM?
DKIM adds a digital signature to email headers using public-key cryptography. The sending server signs the email with a private key, and the receiving server verifies the signature using the public key published in DNS. This proves the email came from an authorized server and hasn't been modified in transit.
How DKIM works
- Sending mail server generates a cryptographic signature of the email content
- Signature is added to the email header as "DKIM-Signature"
- Receiving server extracts the DKIM signature from the header
- Server queries DNS for the sender's DKIM public key (selector._domainkey.domain.com)
- Server verifies the signature using the public key
- Valid signature confirms email authenticity and integrity
✓ DKIM DNS record example
DNS TXT Record — default._domainkey.example.comv=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
DKIM record breakdown
- v=DKIM1 — Version identifier
- k=rsa — Key type (RSA is standard; use 2048-bit minimum)
- p=MII... — Base64-encoded public key
- t=s — (Optional) Strict mode — domain must match exactly
✓ DKIM signature in email header
Email header exampleDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=example.com; s=default; t=1640000000;
h=from:to:subject:date;
bh=2jmj7l5rSw0yVb/vlWAYkK/YBwk=;
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGkwjcOq...
Enabling DKIM in Microsoft 365 and Google Workspace
- Microsoft 365: Defender portal → Email & collaboration → Policies & rules → Threat policies → Email authentication settings → DKIM. Publish the two selector CNAME records Microsoft provides (selector1 and selector2), then enable signing
- Google Workspace: Admin Console → Apps → Google Workspace → Gmail → Authenticate email
- Both platforms generate the key pair and DNS records for you — no manual key generation needed
- Also enable DKIM in any third-party platforms that send email on your behalf (Mailchimp, HubSpot, Salesforce, etc.)
DKIM key rotation best practices
Rotate DKIM keys annually or after any security incident. Use 2048-bit RSA keys minimum (1024-bit is deprecated). Maintain multiple selectors to enable seamless key rotation without service interruption. Microsoft 365 does not rotate keys on its own — use Rotate DKIM keys in the Defender portal or Rotate-DkimSigningConfig in Exchange Online PowerShell. Its two selectors let the new key go live while the old one still validates.
In one sentence: DMARC is the policy layer that tells receiving servers what to do when SPF or DKIM fail — and sends you reports on everything happening with your domain's email.
What is DMARC?
DMARC builds on SPF and DKIM by adding policy enforcement and visibility. It tells receiving mail servers what to do when SPF or DKIM checks fail, and provides aggregate and forensic reports on email authentication results. DMARC is the critical final layer that actually prevents domain spoofing — but only when set to p=quarantine or p=reject.
How DMARC works
- Email arrives at receiving server claiming to be from your domain
- Server checks SPF and DKIM authentication
- Server verifies domain alignment (From: header matches SPF/DKIM domains)
- Server queries your DMARC policy from DNS (_dmarc.domain.com)
- Server applies your policy: none (monitor), quarantine (spam), or reject
- Server sends aggregate and forensic reports to your specified addresses
✓ DMARC policy progression — recommended implementation path
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
v=DMARC1; p=reject; np=reject; rua=mailto:dmarc-reports@example.com
DMARC record components
- v=DMARC1 — Version identifier (required)
- p=none|quarantine|reject — Policy for emails that fail authentication (required)
- rua=mailto:address — Email address for aggregate reports (daily XML summaries)
- ruf=mailto:address — Address for failure reports (optional). Many large mailbox providers don’t send them, and those that do may include message content — send them only to a mailbox you control
- sp=none|quarantine|reject — Policy for subdomains (optional)
- np=none|quarantine|reject — Policy for subdomains that don’t exist, a common spoofing trick (optional)
- t=y|n — Testing flag: tells receivers the policy is still being validated (optional)
- adkim=r|s — DKIM alignment mode; relaxed is the default and the right choice for most domains
- aspf=r|s — SPF alignment mode; relaxed is the default
The May 2026 DMARC update (RFC 9989–9991) removed the pct, rf, and ri tags and added np and t. Receivers now ignore pct=; use t=y instead for a staged rollout.
✓ Production DMARC record — full enforcement
DNS TXT Record — _dmarc.example.comv=DMARC1; p=reject; sp=reject; np=reject; rua=mailto:dmarc-reports@example.com
⚠ Never start with p=reject
Begin with p=none to monitor for 2–4 weeks. Analyze DMARC reports to identify all legitimate email sources. Fix any authentication issues before moving to p=quarantine. Only implement p=reject after achieving 95%+ pass rates and confirming all legitimate senders are authenticated. Jumping to p=reject without monitoring first can block legitimate outbound mail.
Bulk sender requirements
Gmail and Yahoo (since February 2024) and Outlook.com (since May 5, 2025) require domains sending more than 5,000 messages a day to their users to pass SPF and DKIM, publish a DMARC record (p=none at minimum) aligned with the From domain, and include a working unsubscribe for marketing mail. Non-compliant mail is filtered or rejected.
✓ Parked domains — domains that never send email
DNS records — parked-example.com
parked-example.com. TXT "v=spf1 -all"
_dmarc.parked-example.com. TXT "v=DMARC1; p=reject; sp=reject; np=reject"
parked-example.com. MX 0 .
Beyond sender authentication: MTA-STS and TLS-RPT
SPF, DKIM, and DMARC prove who sent a message. MTA-STS requires sending servers to use verified TLS when delivering mail to your domain, and TLS-RPT sends you reports when that fails — closing off downgrade and interception attacks on inbound mail.