← All posts
Web Design Dec 2, 2026 · 4 min read

SPF, DKIM and DMARC: Making Sure Your Site’s Email Actually Arrives

Contact forms are useless if their emails land in spam. Here's how SPF, DKIM and DMARC work, and how to set them up so your WordPress site's email reaches the inbox.

Brett Warnebold, Senior Web Developer & Software Engineer

Brett Warnebold

Senior Web Developer & Software Engineer

Envelope shaped neon lights against a dark background

A client tells you the contact form is broken. You test it, the success message appears, and everything looks fine. The form isn’t broken. The emails are just landing in spam, or being rejected before they ever reach an inbox.

This is one of the most common problems I see on WordPress sites, and the fix lives almost entirely in DNS. Three TXT records, SPF, DKIM and DMARC, tell receiving mail servers that a message claiming to come from your domain is legitimate. Since early 2024, Gmail and Yahoo have required all three for bulk senders, and messages without any authentication increasingly don’t get delivered at all.

Why WordPress email lands in spam

By default, WordPress sends mail through PHP on the web server. That server usually isn’t authorized to send email for your domain, its IP may be shared with hundreds of other sites, and nothing signs the message. To a receiving server, that looks exactly like spoofing.

The first fix isn’t DNS at all: send through a real transactional email service such as Postmark, Mailgun, SendGrid or Amazon SES, using an SMTP plugin. Then set up the three records below so the world knows that service is allowed to send for you.

SPF: who is allowed to send

SPF is a TXT record on your domain listing the servers allowed to send its mail. It usually looks something like this, with one include for each service:

example.com.  TXT  "v=spf1 include:_spf.google.com include:mailgun.org ~all"

Three rules catch almost everyone:

  • Only one SPF record per domain. Two separate v=spf1 records make SPF fail entirely. Merge them into one.
  • Stay under 10 DNS lookups. Each include can trigger more lookups, and going over the limit is a permanent failure. Remove services you no longer use.
  • Know your ending. ~all (soft fail) is the safe starting point. -all (hard fail) is stricter once you’re sure every sender is listed.

DKIM: proof the message wasn’t changed

DKIM adds a cryptographic signature to every message. The sending service signs with a private key, and you publish the matching public key in DNS so receivers can verify it. Your email provider generates the record for you. It lives at a selector under _domainkey, and is often a CNAME so the provider can rotate keys:

pm._domainkey.example.com.  CNAME  pm.provider-dkim.example.net.

Because each service uses its own selector, you can have several DKIM records side by side: one for Google Workspace, one for your transactional service, one for your newsletter tool.

DMARC: the policy that ties it together

DMARC tells receivers what to do when a message fails, and it adds one crucial check called alignment: the domain that passes SPF or DKIM has to match the domain in the visible From address. That’s what actually stops someone else from sending mail that looks like it came from you.

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

Start with p=none, which only monitors. The rua address receives daily reports showing every server sending mail as your domain. Once those reports show your legitimate services all passing, move to p=quarantine and eventually p=reject.

SPF says who can send. DKIM proves it wasn’t tampered with. DMARC decides what happens when either one fails.

One contact form mistake to avoid

Many form plugins default to putting the visitor’s email address in the From field. That’s a guaranteed DMARC failure, because your server is sending mail that claims to come from someone’s Gmail account. Always send from an address on your own domain, like forms@example.com, and put the visitor’s address in the Reply-To header. You can still hit reply and answer them directly.

How to check your setup

Look up the records with dig example.com TXT +short and dig _dmarc.example.com TXT +short. Then send a test message to a Gmail account, open it, and choose Show original. You want to see SPF: PASS, DKIM: PASS and DMARC: PASS. If all three pass, your contact form is finally doing its job, and that client’s “broken” form is fixed for good.

Web Design
Brett Warnebold, Senior Web Developer & Software Engineer

Written by

Brett Warnebold

Senior Web Developer & Software Engineer in Washington, DC, building fast, vibrant sites with React and WordPress since 2018.

Connect on LinkedIn →

Let's build something

Hiring? Let's talk

I'm open to Senior Web Developer and Software Engineer roles. Message me on LinkedIn to set up an interview or see my full experience and recommendations.