PHPCheck.net

Set up SPF, DKIM and DMARC: stop email spoofing

In short
  • SPF defines which servers may send email for your domain.
  • DKIM signs every email cryptographically so receivers can verify it was not altered.
  • DMARC tells receivers what to do with email failing SPF/DKIM – and sends you reports.
  • Goal: SPF ending in -all or ~all, DKIM enabled, DMARC with p=quarantine or p=reject.

Without these records anyone can send email that appears to come from your domain – ideal for phishing and CEO fraud. Since 2024, large mailbox providers such as Gmail and Yahoo require SPF, DKIM and DMARC from bulk senders; without them legitimate email lands in spam more often.

1. SPF: who may send?

example.com.  TXT  "v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net -all"

Common SPF mistakes

2. DKIM: digital signature

Enable DKIM at your email provider; it gives you a DNS record with the public key under <selector>._domainkey.example.com (Microsoft 365: selector1/selector2, Google Workspace: google). The selector in use appears in the DKIM-Signature: … s= header of a sent email. Use keys of at least 2048 bits.

3. DMARC: policy and reports

_dmarc.example.com.  TXT  "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"

Roadmap to p=reject

  1. Set up SPF and DKIM for all senders, publish DMARC with p=none and rua.
  2. Review reports for 2–4 weeks and add missing senders.
  3. Move to p=quarantine (optionally with pct=25 first), then to p=reject.

Domains that send no email

example.com.         TXT  "v=spf1 -all"
_dmarc.example.com.  TXT  "v=DMARC1; p=reject;"
example.com.         MX   0 .        ; "null MX" (RFC 7505)

Check

Enter your domain at PHPCheck.net – the "Email" section shows SPF (incl. lookup count), DMARC policy, DKIM selectors, MTA-STS and TLS-RPT at a glance.

Sources

More guides