SPF, DKIM, and DMARC: Step-by-Step DNS Configuration
Complete DNS tutorial with copy-paste templates for Google Workspace, Microsoft 365, and custom SMTP. Learn how to configure, test, and monitor your email authentication records.
By OutreachDesk Team
Proper DNS configuration is the foundation of reliable email delivery. This guide walks through each record type with exact values you can copy and paste โ whether you're on Google Workspace, Microsoft 365, or a custom SMTP provider.
Quick Context
| Record | What It Proves | DNS Type |
|---|---|---|
| SPF | "This server is allowed to send my email" | TXT on @ (root) |
| DKIM | "This email wasn't modified in transit" | TXT or CNAME on subdomain |
| DMARC | "Here's what to do if SPF or DKIM fail" | TXT on _dmarc subdomain |
Step 1: SPF Record
Google Workspace
DNS Host: @ (or yourdomain.com)
Record Type: TXT
Value:
v=spf1 include:_spf.google.com ~all
Microsoft 365
DNS Host: @
Record Type: TXT
Value:
v=spf1 include:spf.protection.outlook.com ~all
SPF Mechanism Reference
| Mechanism | Meaning | When to Use |
|---|---|---|
-all | Hard fail โ reject everything not listed | When you're 100% sure your list is complete |
~all | Soft fail โ accept but mark suspicious | Safer default. Start here. |
?all | Neutral โ make no judgment | Not recommended. Essentially disables SPF. |
Step 2: DKIM Record
DKIM adds a cryptographic signature to every outgoing email. The recipient server verifies this signature against a public key in your DNS.
Key Length Requirements (2026)
| Key Length | Status | Google/Yahoo |
|---|---|---|
| 2048-bit | โ Required | Minimum accepted |
| 1024-bit | โ Deprecated | Authentication failures |
| 512-bit | โ Never use | Trivially crackable |
Each provider generates DKIM keys differently. Google gives you a TXT record. Microsoft creates CNAME records. Custom SMTPs typically give 2โ3 CNAMEs pointing to their DKIM infrastructure.
Step 3: DMARC Record
DMARC ties SPF and DKIM together and defines your enforcement policy:
DNS Host: _dmarc
Record Type: TXT
Starting Value:
v=DMARC1; p=none; rua=mailto:[email protected]; fo=1
DMARC Tag Reference
| Tag | Purpose | Example |
|---|---|---|
p= | Policy: none / quarantine / reject | p=quarantine |
pct= | % of failing mail to apply policy to | pct=25 |
rua= | Aggregate report destination | rua=mailto:dmarc@... |
fo=1 | Generate forensic report on any failure | fo=1 |
Step 4: Test Everything
- Send a test to
[email protected]โ You'll receive an automated reply with full SPF/DKIM/DMARC analysis - Check OutreachDesk's DNS Health Dashboard โ Color-coded green/amber/red for all four record types
- Review DMARC aggregate reports โ Weekly at minimum. They're your early warning system for configuration drift and spoofing attempts
Ready to apply these tips?
OutreachDesk gives you all the tools you need for email outreach โ privacy-first on your cloud.
Get Started Free