DNS Email Security
SPF, DKIM, and DMARC are DNS-based email authentication standards that prevent spoofing, phishing, and unauthorized use of your domain in email.
Email Authentication Standards
Each standard addresses a different aspect of email identity verification
SPF
RFC 7208Specifies which IP addresses and mail servers are authorized to send email on behalf of your domain. Verified by checking the Return-Path (envelope sender) against your DNS TXT record.
DKIM
RFC 6376Adds a cryptographic signature to outbound email headers. Recipients verify the signature using the public key published in your DNS. Proves message integrity and domain ownership.
DMARC
RFC 7489Builds on SPF and DKIM. Tells receiving servers what to do when authentication fails (none/quarantine/reject) and where to send aggregate reports. Requires alignment between header From and SPF/DKIM domains.
Sender Policy Framework
How SPF Works
When a receiving mail server gets a message, it looks up the SPF record for the domain in the email's envelope from(Return-Path) address. It then checks whether the sending server's IP is authorized in that record.
SPF Mechanisms
ip4/ip6Authorize specific IP addresses or CIDR rangesinclude:Include another domain's SPF policy (e.g., Google Workspace)aAuthorize the domain's A record IPmxAuthorize the domain's MX record IPsredirect=Use another domain's SPF record entirelyDomainKeys Identified Mail
How DKIM Works
Your mail server signs outbound messages with a private key. The corresponding public key is published as a DNS TXT record. Receiving servers retrieve the public key and verify the signature.
Generate RSA 2048-bit (minimum) or Ed25519 key pair.
Mail server adds DKIM-Signature header to every message.
Public key published as TXT at selector._domainkey.yourdomain.
Receiving server retrieves key, verifies signature mathematically.
Domain-based Message Authentication, Reporting & Conformance
DMARC Tag Reference
MTA-STS & TLS Reporting
MTA-STS (RFC 8461) forces TLS for email transport to your mail servers, preventing downgrade attacks and opportunistic interception.
SMTP TLS Reporting (RFC 8460) provides visibility into TLS negotiation failures, helping you detect misconfigurations and attacks.
Together they form the final layer of email security — after ensuring your messages are authenticated (SPF/DKIM/DMARC), MTA-STS ensures they're delivered securely.
Deployment Roadmap
A phased approach to full email authentication — from zero to p=reject
Inventory & SPF
- Identify all mail-sending systems (ESP, CRM, app servers)
- Create SPF record with ~all (softfail) initially
- Publish SPF TXT record at your apex domain
- Test with: dig thedns.guru TXT
DKIM Setup
- Generate RSA 2048-bit key pair per sending domain/service
- Publish public key as TXT record at selector._domainkey
- Configure mail server/ESP to sign outbound messages
- Verify signing with: dig mail._domainkey.thedns.guru TXT
DMARC Monitoring
- Publish DMARC record with p=none to begin
- Set rua to collect aggregate XML reports
- Analyze reports for 2-4 weeks to identify all senders
- Ensure SPF and DKIM pass for all legitimate mail
DMARC Enforcement
- Move to p=quarantine with pct=10, increase gradually
- Once confident, move to p=reject
- Consider BIMI for brand logo in email clients
- Add MTA-STS and TLS-RPT for transport security
Brand Indicators for Message Identification
Once you reach DMARC p=reject, you can implement BIMI — a DNS record that displays your brand logo in supporting email clients (Gmail, Yahoo, Apple Mail).
Requires a Verified Mark Certificate (VMC) from a CA like Entrust or DigiCert, and your logo in SVG Tiny 1.2 format.