SPF, DKIM and DMARC Explained: A Step-by-Step Setup Guide

SPF, DKIM and DMARC Explained: A Step-by-Step Setup Guide

If your domain doesn’t have SPF, DKIM and DMARC, anyone can send email that appears to come from [email protected]. Criminals use this to send fake invoices to your customers, and your own legitimate email is more likely to land in spam.

Since 2024, Google and Yahoo require SPF, DKIM and DMARC for bulk senders, and Microsoft has introduced similar requirements for Outlook.com. Every business domain should have all three.

What each one does

RecordWhat it doesAnalogy
SPFLists the servers allowed to send email for your domainA guest list
DKIMAdds a digital signature to each email, proving it wasn’t changedA wax seal
DMARCTells receivers what to do if SPF or DKIM fail, and sends you reportsThe policy and the security report

All three are DNS TXT records (DKIM is sometimes a CNAME) that you add at your DNS provider, such as Cloudflare, GoDaddy, Hostinger or your domain registrar.

Step 1: List everything that sends email as your domain

Before creating records, list every service that sends email using your domain:

  • Microsoft 365 or Google Workspace
  • Newsletter tools (Mailchimp, MailerLite, Brevo)
  • Your website (contact forms, WooCommerce)
  • Invoicing, CRM and helpdesk tools
  • Scanners and printers that send email

Missing a service is the most common reason legitimate email starts failing.

Step 2: Create an SPF record

SPF is a single TXT record at the root of your domain (@). Examples:

Microsoft 365:

v=spf1 include:spf.protection.outlook.com -all

Google Workspace:

v=spf1 include:_spf.google.com -all

Microsoft 365 plus a newsletter service:

v=spf1 include:spf.protection.outlook.com include:_spf.mlsend.com -all

Use the exact include value from each provider’s documentation.

Rules to remember:

  • Only one SPF record per domain. Merge them into a single record if you have several.
  • SPF allows a maximum of 10 DNS lookups. Each include uses at least one. Too many includes break SPF.
  • -all (hard fail) tells receivers to reject unlisted senders. ~all (soft fail) marks them as suspicious. Start with ~all if you’re not sure every sender is listed, then tighten.

Step 3: Turn on DKIM

DKIM is set up in your email service, which gives you the records to add.

Microsoft 365: in the Microsoft Defender portal, go to Email & collaboration > Policies & rules > Threat policies > Email authentication settings > DKIM. Select your domain. Microsoft shows two CNAME records (selector1._domainkey and selector2._domainkey). Add them to DNS, wait for them to be visible, then turn on signing.

Google Workspace: in the Admin console, go to Apps > Google Workspace > Gmail > Authenticate email. Generate a 2048-bit key, add the TXT record at google._domainkey, then click Start authentication.

Set up DKIM for your other sending services too. Most newsletter and CRM tools provide their own DKIM records.

Step 4: Add DMARC in monitoring mode

Create a TXT record at _dmarc.yourcompany.com:

v=DMARC1; p=none; rua=mailto:[email protected]; fo=1
  • p=none means monitor only. Nothing is blocked yet.
  • rua is where receivers send daily aggregate reports. Use a dedicated mailbox or a DMARC reporting service, because the reports are XML files that are hard to read by hand. Several services offer free tiers.

Step 5: Read the reports and fix gaps

For two to four weeks, review the reports. They show every source sending email as your domain, and whether SPF and DKIM pass.

  • Legitimate sources failing? Add them to SPF and set up DKIM for them.
  • Unknown sources? These may be spoofing attempts, or a forgotten service.

Step 6: Move to enforcement

When all legitimate email passes, tighten the policy step by step:

v=DMARC1; p=quarantine; pct=25; rua=mailto:[email protected]

Then increase to pct=100, and finally:

v=DMARC1; p=reject; rua=mailto:[email protected]

At p=reject, receivers block email that fails DMARC. That’s the level that really stops criminals spoofing your domain.

Protect domains that don’t send email

If you own domains that never send email (old brand names, typo domains), publish records that block all email:

SPF:   v=spf1 -all
DMARC: v=DMARC1; p=reject;

Common mistakes

  • Two SPF records on the same domain, which makes both invalid
  • Too many SPF lookups after adding many services
  • Forgetting a sending service, such as the website’s contact form
  • Jumping straight to p=reject without monitoring first
  • Setting DMARC once and never reading the reports

Quick checklist

StepDone when
Sending services listedEvery tool that sends as your domain is known
SPFOne record, under 10 lookups, all senders included
DKIMSigning on for Microsoft 365/Google and other senders
DMARC p=noneReports arriving and reviewed for 2–4 weeks
DMARC enforcementMoved to quarantine, then reject
Parked domainsv=spf1 -all and p=reject

Setting up SPF, DKIM and DMARC is one of the best-value security tasks for any business. It protects your customers from fake invoices in your name, and it helps your real email reach the inbox. If your messages already go to spam, see why business emails go to spam.