Skip to main content
mailers.io

Deliverability and authentication

SPF, DKIM and DMARC explained in plain terms

By mailers.io team Published 5 min read

E-mail was designed without a way to prove who sent a message. Anyone can type any address into the From field. SPF, DKIM and DMARC are three add-ons that were bolted on later to fix that. They are all DNS records, they work together, and each answers a different question. This post explains the three in plain terms, then shows where mailers.io fits in.

The problem they solve

When a message arrives, the receiving server sees two things that can differ. One is the visible From address, the one a person reads. The other is the technical sender: the server that connected, and the return path it used. A scammer can set the visible From to your domain while sending from somewhere else.

The receiver needs a way to ask: “Is this server allowed to send for this domain? Was this message changed on the way? And what should I do if the answer is no?” Those are the three questions below.

SPF: which servers may send

SPF (Sender Policy Framework) is a list of servers that are allowed to send mail for a domain. You publish it as a TXT record that starts with v=spf1. A receiver looks at the domain in the return path (the envelope sender), fetches that record and checks whether the connecting server’s IP address is on the list.

A typical record names the services you use and ends with a rule for everything else. A hard fail (-all) says “reject anything not listed”. A soft fail (~all) says “treat anything not listed as suspicious”.

Two limits are worth knowing now:

  • SPF checks the return path domain, not the visible From domain. Many providers use their own return path, so SPF can pass for the provider while telling the receiver nothing about your domain.
  • SPF breaks when a message is forwarded, because the forwarding server is not on your list.

SPF also allows at most ten DNS lookups. If you include many services in one record, you can go over that and the whole record fails.

DKIM: a signature on each message

DKIM (DomainKeys Identified Mail) is a digital signature. The sending system holds a private key and adds a DKIM-Signature header to every message. The header names the signing domain (d=) and a selector (s=). The receiver reads the selector, looks up the public key in DNS at <selector>._domainkey.<domain>, and checks the signature against the message.

If the check passes, two things are true: the message was signed by someone who controls that domain’s DNS, and the signed parts of the message were not altered on the way. Unlike SPF, DKIM usually survives forwarding.

The selector lets one domain publish several keys at once. That is how you can use more than one service for the same domain, and how you rotate keys without a gap.

DMARC: what to do, and the alignment rule

DMARC (Domain-based Message Authentication, Reporting and Conformance) ties the other two to the visible From domain. It adds two things.

Alignment. DMARC passes only if SPF or DKIM passes and the domain that passed matches the From domain. “Matches” can be strict (the same name) or relaxed (the same organisational domain, so mail.example.com aligns with example.com). This is the step that stops the From spoofing described above: a provider’s own SPF pass does not count, because its domain is not yours.

A policy. Your DMARC record, a TXT record at _dmarc.<your domain>, says what receivers should do with a message that fails: p=none (just report), p=quarantine (treat as suspicious, often the spam folder) or p=reject (refuse it). It can also name an address for aggregate reports, which show you who is sending mail as your domain.

Because DMARC passes on either SPF or DKIM aligned, the practical goal is to get DKIM aligned for every service you send through. DKIM is the one that survives forwarding. The next steps for the policy are in rolling out a DMARC policy from none to reject.

Putting the three together

What it proves Where it lives Checked against
SPF The sending server is allowed TXT at the domain Return path domain
DKIM The message is signed and unaltered TXT at <selector>._domainkey Signing domain in the header
DMARC One of the two passed and matches From; the policy TXT at _dmarc Visible From domain

A message that passes DKIM with a signing domain equal to your From domain passes DMARC even if SPF fails. A message that passes SPF only for a provider’s return-path domain fails DMARC.

Why large mailbox providers ask for all three

Gmail and Yahoo set requirements for senders of bulk mail: authenticate with SPF and DKIM, publish a DMARC record, keep complaint rates low and support one-click unsubscribe. Read the current wording on the providers’ own sender pages, because thresholds and dates change. What does not change is the direction: unauthenticated mail from your own domain is getting harder to deliver.

Where mailers.io fits

mailers.io sends through servers you connect yourself, so these records are about your domain and your providers, not ours. Here is what the product does with them.

  • DKIM is the record that verifies a sending domain. When you add a domain, mailers.io creates a 2048-bit RSA key for it and shows the TXT record to publish. It checks DNS for that record and marks the domain verified when it matches. For servers added over SMTP, mailers.io signs the message with that key. For API providers such as Amazon SES, the domain is registered at the provider and the provider signs.
  • SPF and DMARC are advice. On each check mailers.io also looks for a v=spf1 record at the domain and a v=DMARC1 record at _dmarc, and shows whether it found them. A missing one never blocks sending.
  • Subdomains. A subdomain signs with the parent’s key, which works with relaxed DMARC alignment.

The full walk-through, including what happens when a check starts failing, is in adding a sending domain in mailers.io, and the feature page is sending domains. If you send cold e-mail, keep it on its own subdomain so that its reputation does not touch your main domain; see the cold-email subdomain strategy.

A short checklist

  1. Publish DKIM for every service that sends as your domain.
  2. Publish one SPF record that lists those services, and keep it under ten lookups.
  3. Publish a DMARC record with p=none and a report address, read the reports, and tighten the policy later.
  4. Check that the domain in the DKIM signature matches, or is a subdomain of, your From domain.

None of this guarantees inbox placement. It removes a reason for rejection and lets receivers trust the mail that is really yours.

Questions and answers

Do I need all three?

For mail to Gmail and Yahoo at any volume, yes in practice. Large mailbox providers ask bulk senders to authenticate with SPF and DKIM and to publish a DMARC record.

Where do these records live?

All three are DNS TXT records on your domain. SPF is at the domain itself, DKIM at a selector name under _domainkey, and DMARC at _dmarc.

Does passing all three guarantee inbox placement?

No. Authentication proves who you are. Whether a message reaches the inbox also depends on your reputation, your content and how recipients react.

Written by the mailers.io team. Published .

Keep reading

Related posts

Send cold e-mail from your own servers.

Connect your servers, import a list and write the steps. Replies stop the sequence.

  • 7-day money-back guarantee
  • Bring your own providers
  • Cancel anytime