Email Authentication: SPF, DKIM, and DMARC Explained

Why Email Authentication Matters

Email was designed in an era of trust. The original SMTP protocol had no built-in mechanism to verify that the sender of a message is who they claim to be. Anyone could set up an SMTP server, claim to be [email protected], and send messages that looked completely legitimate. This design flaw is the foundation of phishing, spoofing, and business email compromise attacks that cost organizations billions annually.

Email authentication fixes this by adding DNS-based verification layers. Three complementary protocols — SPF, DKIM, and DMARC — work together to let receiving mail servers verify that incoming messages genuinely originated from authorized servers. Together, they form a defense that, when properly configured, eliminates nearly all domain spoofing.

Beyond security, email authentication directly affects deliverability. Gmail, Outlook, and Yahoo now require SPF, DKIM, and DMARC for bulk senders. Without them, your legitimate emails land in spam folders — or are rejected entirely.

SPF (Sender Policy Framework)

SPF is the simplest authentication method. It's a DNS TXT record that lists the IP addresses and servers authorized to send email on behalf of your domain. When a receiving mail server gets a message claiming to be from yourdomain.com, it checks your SPF record. If the sending server's IP is listed, the message passes SPF.

A basic SPF record looks like this:

yourdomain.com.  IN  TXT  "v=spf1 include:_spf.google.com include:mailgun.org ~all"

Breaking down the syntax:

SPF limits: DNS lookups are limited to 10 per SPF evaluation. If your record chains through too many include statements, receivers stop evaluating and return "permerror." Keep your includes under 10, and flatten if necessary.

The SPF forwarding problem: When email is forwarded (e.g., a university alumni address forwarding to Gmail), the forwarding server's IP isn't in your SPF record. SPF breaks on forwarded mail. This is why DKIM exists — it survives forwarding because the signature is in the email headers, not tied to the connecting IP.

DKIM (DomainKeys Identified Mail)

DKIM adds a cryptographic signature to outgoing emails. The sending mail server signs specific headers and the email body using a private key. The public key is published in DNS. The receiving server retrieves the public key, verifies the signature, and confirms the email wasn't tampered with in transit.

A DKIM DNS record looks like this:

selector._domainkey.yourdomain.com.  IN  TXT  "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3..."

The selector is a label you choose — it lets you rotate keys without downtime. Multiple selectors can coexist, allowing gradual key transitions. The p= value is the base64-encoded public key.

Key points about DKIM:

DMARC (Domain-based Message Authentication, Reporting & Conformance)

DMARC ties SPF and DKIM together and adds a policy enforcement layer. It answers the question: "What should the receiver do if SPF or DKIM fails?" Without DMARC, receivers make their own decisions — some quarantine, some deliver with a warning, some silently drop. DMARC lets you specify the policy.

A DMARC record looks like this:

_dmarc.yourdomain.com.  IN  TXT  "v=DMARC1; p=quarantine; rua=mailto:[email protected]; pct=50; adkim=s; aspf=s"

Breaking down the tags:

The DMARC Rollout Process

Never deploy DMARC in p=reject mode immediately. You'll block legitimate mail. Follow this phased approach:

Phase 1 — Monitor (p=none): Deploy DMARC with p=none and a rua report address. Collect daily aggregate reports for 2-4 weeks. These reports show you every sender using your domain, including third-party services you forgot about (marketing platforms, billing systems, CRM tools).

v=DMARC1; p=none; rua=mailto:[email protected]; pct=100

Phase 2 — Identify and fix: Analyze the reports. Identify all legitimate senders. Add missing ones to SPF. Ensure all senders sign with DKIM. Fix alignment issues (e.g., a third-party sender using their domain in the envelope-from without proper DKIM alignment).

Phase 3 — Quarantine (p=quarantine, pct=1): Switch to quarantine mode at 1%. Monitor for complaints about missing emails. If clean, increase: 5%, 25%, 50%, 100%.

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

Phase 4 — Reject (p=reject, pct=100): After 4-8 weeks of clean quarantine at 100%, switch to reject. Spoofed email is now blocked at the receiver level.

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

Common Configuration Mistakes

Verifying Your Setup

Once configured, verify with these DNS lookups:

Send a test email to mail-tester.com or [email protected] for a comprehensive authentication report. These services show you exactly what a receiving server sees.

Use our DNS Lookup tool to verify your SPF, DKIM, and DMARC records are published correctly.

Check your DNS records →