Email Security Guide
This guide is for IT consultants helping clients secure email on new or existing domains. It covers DNS authentication (SPF, DKIM, DMARC) and how it applies across common platforms—Google Workspace, Microsoft 365, Proton, and custom hosting. See the Enterprise Playbook v3.0 for the full consultant lifecycle (Cloudflare, BIMI, DMARC graduation, SB 2610). See Platform guides for provider-specific checklists.
This guide explains how to protect a domain’s email channel using DNS-based authentication and related controls. It is organized around two common situations:
- New domain — You are bringing a domain online and want correct authentication from day one.
- Existing domain — Mail is already flowing; you need to discover what is sending, fix gaps, and tighten policy without breaking legitimate traffic.
Use the dedicated checklists for day-to-day execution:
How the pieces fit together
| Control | What it does | DNS location (typical) |
|---|---|---|
| SPF | Lists hosts allowed to send mail for the domain | TXT at @ (root) |
| DKIM | Cryptographic signature on each message; public key in DNS | TXT at selector._domainkey |
| DMARC | Policy when SPF/DKIM fail; aggregate/forensic reports | TXT at _dmarc |
| CAA (recommended) | Restricts which CAs may issue TLS certs for the domain | CAA at root |
| DNSSEC (recommended) | Signs DNS responses to reduce spoofing of your zone | Provider-specific |
SPF and DKIM prove authenticity. DMARC tells receivers what to do when checks fail and gives you visibility through reports.
flowchart LR
subgraph send [Your infrastructure]
M[Mail servers / SaaS]
end
subgraph dns [DNS]
SPF[SPF TXT]
DKIM[DKIM TXT]
DMARC[DMARC TXT]
end
subgraph recv [Receiving provider]
V[SPF + DKIM verify]
P[Apply DMARC policy]
end
M --> V
SPF --> V
DKIM --> V
V --> P
DMARC --> P
Phase 0: Inventory (both new and existing)
Before changing DNS, document every system that sends mail as your domain (not only “from” your primary mailbox):
| Category | Examples |
|---|---|
| Productivity | Google Workspace, Microsoft 365 |
| Marketing | Mailchimp, HubSpot, Constant Contact |
| Transactional | SendGrid, Postmark, Amazon SES, Mailgun |
| CRM / sales | Salesforce, outreach tools |
| Internal | Ticketing, monitoring, scripts on fixed IPs |
For each sender, record:
- Service name and business owner
- Hostname or subdomain used in
MAIL FROM/ envelope - SPF:
include:domain orip4:/ip6:values - DKIM: selector name and where to publish the public key
- Whether the
From:domain aligns with your domain (important for DMARC)
New domain: Complete this inventory before go-live so the first SPF/DKIM/DMARC records are complete.
Existing domain: Treat this as discovery—compare inventory to DMARC aggregate reports (rua) to find unknown senders.
SPF (Sender Policy Framework)
Syntax essentials
- Start with
v=spf1. - Add mechanisms:
include:,ip4:,ip6:,a:,mx:(use sparingly). - End with a qualifier:
-all(hard fail, preferred) or~all(soft fail). Never use+all. - One SPF TXT record per hostname (only one per domain/subdomain that sends mail).
Example (illustrative):
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.10 -all
Limits and pitfalls
- Maximum 10 DNS lookups (each
include:and some other mechanisms count). Exceeding the limit causes SPF to fail for everyone. - Subdomains do not inherit the root SPF record—create SPF for each subdomain that sends mail (e.g.
notifications.example.com). - Consolidate multiple
include:entries into a single record; never publish two SPF TXT records on the same name.
Verification
dig TXT example.com +short
Look for v=spf1 and confirm -all or ~all at the end.
DKIM (DomainKeys Identified Mail)
Setup flow
- Enable DKIM in each sending platform (admin console).
- Publish the provider’s public key as a TXT record:
SELECTOR._domainkey.example.com. - Keep the private key only on the mail platform; rotate per vendor guidance (often every 6–12 months).
Typical record shape:
v=DKIM1; k=rsa; p=<base64-public-key>
Use 2048-bit keys when the provider supports them.
Pitfalls
- Selector mismatch between DNS host name and the signing service.
- Stale keys after migration—old selector still in DNS while mail signs with a new key.
- Multiple providers = multiple selectors (one TXT record per selector).
Verification
dig TXT google._domainkey.example.com +short
Send test mail; headers should show dkim=pass in Authentication-Results.
DMARC (Domain-based Message Authentication, Reporting & Conformance)
Record location
Host/name: _dmarc (full name: _dmarc.example.com)
Recommended progression
| Stage | Policy | Purpose |
|---|---|---|
| 1 – Monitor | p=none |
Collect reports; fix alignment and missing senders |
| 2 – Soft enforce | p=quarantine |
Failed mail to spam/junk |
| 3 – Enforce | p=reject |
Block spoofed mail that fails auth |
Starter record (monitoring):
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; adkim=r; aspf=r;
Tighten when legitimate mail consistently passes:
v=DMARC1; p=quarantine; sp=quarantine; np=reject; rua=mailto:dmarc-reports@example.com
Goal state:
v=DMARC1; p=reject; sp=reject; np=reject; rua=mailto:dmarc-reports@example.com
Roll out by changing p (none → quarantine → reject). Do not use fractional pct — DMARCbis (RFC 9989) obsolete that tag; most receivers ignored it anyway. For temporary monitor-while-enforced testing, use t=y instead of pct=0.
Tags to know
| Tag | Meaning |
|---|---|
p |
Policy for organizational domain |
sp |
Policy for subdomains (if different) |
np |
Policy for non-existent subdomains (DMARCbis; prefer reject) |
rua |
Aggregate report mailbox(es) |
ruf |
Forensic reports (optional; privacy-sensitive) |
t |
Testing mode (t=y = treat policy as monitor-only; default off) |
pct |
Legacy — omit on new records; safe to remove if present |
adkim / aspf |
Strict (s) vs relaxed (r) alignment |
Alignment
DMARC passes only when the domain in the visible From: header aligns with the domain validated by SPF or DKIM. Third-party tools that send From: vendor.com while using your envelope domain often need configuration changes (custom return-path, aligned DKIM) or separate subdomains.
Reports
- Aggregate (
rua) XML reports summarize sources and pass/fail counts—essential before moving pastp=none. - Review weekly during monitoring; investigate new sources before tightening policy.
Additional DNS hardening
CAA (Certificate Authority Authorization)
Restrict TLS certificate issuance to CAs you actually use:
example.com. CAA 0 issue "letsencrypt.org"
example.com. CAA 0 issuewild "letsencrypt.org"
example.com. CAA 0 iodef "mailto:security@example.com"
DNSSEC
Enable at your DNS provider when supported. Misconfiguration can break resolution for validating resolvers—follow provider docs and verify with dig +dnssec example.com.
Subdomain and dangling records
- Remove dangling CNAME records (targets you no longer control)—subdomain takeover risk.
- Avoid publishing internal hostnames or secrets in TXT records.
New domain vs existing domain
New domain (greenfield)
- Complete sender inventory before DNS cutover.
- Publish MX, SPF, DKIM, and DMARC (
p=none) together. - Verify with test messages before marketing or bulk sends.
- Schedule DMARC enforcement only after 2–4 weeks of clean reports (adjust for volume).
Existing domain (brownfield)
- Do not jump to
p=rejectwithout reports. - Audit current TXT/CAA/MX; fix
+all, duplicate SPF, and missing DKIM. - Add or fix
rua; runp=noneuntil all legitimate sources pass. - Communicate with owners of CRM/marketing tools before quarantine/reject.
- Re-test after any provider change, IP change, or new subdomain.
Troubleshooting
| Symptom | Likely cause | Action |
|---|---|---|
| SPF fail for all mail | No record, multiple SPF records, or >10 lookups | Single consolidated SPF; flatten or replace include: with IPs |
| SPF fail for one service | Missing include: or IP |
Add sender to SPF; wait for DNS TTL |
| DKIM fail | Wrong selector, typo in p=, key rotation not updated |
Match selector; republish key from provider |
| DMARC fail, SPF/DKIM pass | Alignment (From domain ≠ signing domain) | Configure provider for aligned DKIM or dedicated subdomain |
| Legitimate mail blocked after enforce | Moved to p=reject too soon |
Revert to p=quarantine or p=none (or set t=y briefly); fix source; re-enforce via none → quarantine → reject |
| Changes “not working” | DNS propagation / cache | Lower TTL before changes; wait up to 48h; flush local DNS cache |
Useful tools
- Command line:
dig,nslookup - Online: MXToolbox, dmarcian, vendor “troubleshoot authentication” wizards
- Header inspection: recipient “Show original” / message source view
Maintenance cadence
| Interval | Task |
|---|---|
| Quarterly | Review sender inventory vs DMARC reports; remove decommissioned include: entries |
| On change | Re-verify SPF/DKIM/DMARC when adding mail vendors, IPs, or subdomains |
| Annually | DKIM key rotation per policy; CAA and DNSSEC review |