Email Security for Founders: SPF, DKIM and DMARC Explained

If anyone can send email that looks like it came from your domain, your customers pay for it. SPF, DKIM and DMARC fix that. Here is what each does, a safe setup order and common mistakes.

Dr. Security3 MIN READ

💡 The short version: email has no built-in proof of who sent it. SPF, DKIM and DMARC are three DNS records that add that proof. Set them up in that order and nobody can easily send convincing email pretending to be your company.

Picture a customer getting an email "from" billing@yourcompany.com asking them to pay a new bank account. You never sent it. Without the three records below, your domain can be used for exactly that, and the customer will blame you. 📧

1️⃣ SPF: who may send for you

A DNS record listing the services allowed to send mail for your domain. Receivers check whether the sender is on the list.

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

Rules of thumb:

  • Have one SPF record per domain, not several. Combine them.
  • SPF allows at most 10 DNS lookups, and every include: adds some. Go over and it stops working.
  • Avoid the old ptr mechanism.
  • End with ~all (soft fail) or -all (hard fail) once you've listed everything.

2️⃣ DKIM: a signature on every message

Your mail provider signs each outgoing message, and publishes the matching public key in DNS so receivers can check the signature. It proves the message wasn't altered and that your provider authorised it.

  • Your provider gives you a record to add under a name like selector._domainkey.yourcompany.com.
  • Use the strongest key size your provider offers. A key under 1024 bits is considered weak.
  • Add one for each service that sends as you: your mailbox provider, your newsletter tool, your app's email service.

3️⃣ DMARC: what to do when checks fail

DMARC ties SPF and DKIM to the address people actually see in the "From" line, and tells receivers what to do with mail that fails. It also sends you reports.

_dmarc.yourcompany.com  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@yourcompany.com"
PolicyWhat it means, and when to use it
p=noneWatch only, deliver everything. Start here and read the reports.
p=quarantineFailing mail is treated as suspicious, usually sent to spam. Use it once your real senders all pass.
p=rejectFailing mail is refused. This is the goal.

🪜 A safe order

  1. List every service that sends mail as your domain.
  2. Publish SPF, then DKIM for each sender.
  3. Publish DMARC with p=none and a reporting address.
  4. Read the reports for a few weeks, fix senders that fail.
  5. Move to quarantine, then reject.

🙈 Common mistakes

  • Two SPF records, or one with too many include: lookups.
  • A DMARC policy that stays on none forever.
  • An enforcing DMARC policy with pct under 100, sp=none or no reporting address, which leaves gaps or leaves you blind.
  • Forgetting the service that sends your app's emails.

🤖 What a scan checks

Dr. Security reads your MX, SPF and DMARC records and tries many common DKIM selectors, then grades the result. Only certain problems count as findings: a DKIM key under 1024 bits, an SPF record over ten lookups or using ptr, and an enforcing DMARC policy with the gaps above. A missing DKIM record is never reported as a problem, only noted, because DKIM selectors can't be guessed for every provider. On a free report you see the email grade.

Got your records ready? Pair this with the 30-minute pre-launch check.

🚀 See how your domain grades. Run a free scan.

  • spf dkim dmarc
  • email spoofing
  • dmarc setup
  • email security for startups
  • domain email security

FIND OUT WHAT YOU'RE EXPOSING.