Skip to content

SPF, DKIM and DMARC, Step by Step

Why Email Lands in Spam Without Them

Anyone can type your domain into the From line of an email. Inboxes know this, so they check three things before they trust a message that claims to come from you: was the sending server allowed (SPF), is the message signed and unchanged (DKIM), and what do you want done when those checks fail (DMARC).

If the checks are missing, the message looks the same as a forged one. It gets filtered, or lands in spam, even if the content is fine. Since 2024, Gmail and Yahoo have asked bulk senders (more than 5,000 messages a day to their users) to have all three in place.

The Three Records

SPF

Lists the servers allowed to send mail for your domain.

Where it goes
A TXT record on your domain, for example example.com
Example
v=spf1 include:sender.example.net ~all

A domain may have only one SPF record. If you already have one, add the new include inside it instead of creating a second record. SPF also allows at most 10 DNS lookups.

DKIM

Signs each message so receivers can tell it was not changed on the way.

Where it goes
A record at selector._domainkey.example.com, given to you by your sending service
Example
selector1._domainkey.example.com CNAME selector1.sender.example.net

Your sending service holds the private key and signs each message. You only publish the public part in DNS. Copy the exact name and value it shows you.

DMARC

Tells receivers what to do when SPF and DKIM fail, and sends you reports.

Where it goes
A TXT record at _dmarc.example.com
Example
v=DMARC1; p=none; rua=mailto:[email protected]

Start with p=none so nothing is blocked while you watch the reports. Move to quarantine, then reject, once every legitimate sender passes.

Set Them Up in This Order

  1. 1

    List Everything That Sends as Your Domain

    App email, your mailbox provider, a newsletter tool, a support desk. Each needs to pass SPF or DKIM, or DMARC will flag it.

  2. 2

    Publish SPF

    Add one TXT record that includes every sender. Keep it to a single record.

  3. 3

    Publish DKIM

    Add the DKIM record your sending service gives you. Add one for each service that sends.

  4. 4

    Publish DMARC with p=none

    Add the _dmarc TXT record and point rua at an inbox you read.

  5. 5

    Test

    Send a message to a Gmail address, open it, choose Show original and look for SPF: PASS, DKIM: PASS and DMARC: PASS.

  6. 6

    Read Reports for 2 to 4 Weeks, Then Tighten

    Fix any legitimate sender that fails. Then move the policy to quarantine and finally reject.

Mistakes That Break It

  • Two SPF records on one domain. Receivers treat this as an error. Merge them into one.
  • Going straight to p=reject. A forgotten sender, like an old invoicing tool, then loses all its mail.
  • Putting the DKIM value in the wrong place. The name must include the selector and _domainkey.
  • Forgetting alignment. DMARC needs the visible From domain to match the domain that passed SPF or DKIM.
  • Editing DNS and testing at once. Changes can take time to spread, so wait before you decide it failed.

Questions

Do I need all three?

Yes. SPF and DKIM prove who sent the message, and DMARC tells receivers how to treat failures. Gmail and Yahoo began requiring all three from bulk senders in 2024, and having them helps everyone else too.

Will SPF, DKIM and DMARC stop my email going to spam?

They remove one common reason for it, and without them delivery is much harder. They do not guarantee the inbox: content, sending patterns and complaint rates matter too.

How long do DNS changes take?

Often a few minutes, sometimes a few hours. Your DNS provider shows the record lifetime (TTL), which is the longest a stale answer should last.

How does Traffsite help?

When you add a domain, the dashboard shows the exact records to publish and checks MX, SPF, DKIM and DMARC for you, so you can see what is still missing.

Choosing a sender? See how Traffsite compares in Amazon SES alternative.

Let the Dashboard Check Your Records.

Add your domain and see what passes and what is still missing.