All help articles

SPF, DKIM and DMARC

These three DNS-based checks tell the world which servers may send mail for your domain, and let Mailocity tell real mail from forged mail when it arrives. This article covers both directions: the records your domain publishes, and the checks Mailocity runs on mail it receives.

Your domain's records

Each domain's DNS checklist (GET /v1/tenants/{id}/domains/{domain}/dns, and the domain screen in the admin panel from M2) lists an SPF record, one DKIM record per key and a DMARC record. The SPF and DMARC records are built from the domain's settings, so change the settings first, then copy the new values into your DNS.

SettingDefaultWhat it does
spfExtranoneOther services allowed to send for the domain, such as a newsletter or CRM tool: include:<domain>, ip4:<address>[/bits], ip6:<address>[/bits], a, mx, a:<domain>, mx:<domain>. Up to 10 entries, of which at most 8 can be include, a or mx.
spfAll-all-all tells receivers to fail mail from other servers; ~all asks them only to treat it with suspicion. Use ~all while you find every service that sends for you.
dmarcPolicyquarantineWhat receivers do with mail that claims your domain but fails both SPF and DKIM: none (just report), quarantine (spam folder) or reject.
dmarcSubdomainPolicysame as policyThe policy for subdomains such as news.example.com.
dmarcPercent100Apply the policy to only this share of failing mail while you roll it out.
dmarcDkimAlignment, dmarcSpfAlignmentstrictStrict needs the signing or envelope domain to equal the From domain. Relaxed also accepts other names under the same registered domain, which some sending services need.
dmarcCollectonAsk for daily aggregate reports at dmarc-reports@<domain> and keep them in Zappocity. See DMARC reports.
dmarcReportsnoneUp to 5 more addresses that receive daily aggregate reports.
dmarcFailureReportsnoneUp to 5 addresses for reports about single failing messages. Few receivers send these.

Example: allow a newsletter service and move to reject:

PATCH /v1/tenants/{id}/domains/example.com
{"spfExtra": ["include:_spf.example-newsletters.com"], "dmarcPolicy": "reject",
 "dmarcReports": ["dmarc@example.com"]}

A safe way to tighten DMARC

  1. Start with dmarcPolicy: none for a couple of weeks while reports arrive (report collection is on by default).
  2. Read the report summary and add any legitimate senders to spfExtra (and set up DKIM with those services).
  3. Move to quarantine, optionally with dmarcPercent below 100, then to reject.

Reports sent to an address on another domain only arrive if that domain agrees to take them: it must publish a TXT record named example.com._report._dmarc.<its-domain> with the value v=DMARC1. The reports collected at dmarc-reports@<domain> need nothing extra; see DMARC reports.

Checks on incoming mail

Every message that arrives from another server on port 25 is checked before it is delivered:

The results are added to the message as an Authentication-Results header naming this server. Any header of that name that already claims to come from this server is removed first, so senders cannot forge a pass.

What happens when DMARC fails depends on the recipient domain's inboundAuth setting:

inboundAuthSender's policy is rejectSender's policy is quarantine
enforce (default)Refused with 550 5.7.1Delivered to Junk
junkDelivered to JunkDelivered to Junk
tagDelivered to the inboxDelivered to the inbox

More details:

Not yet