What are DKIM and SPF and how do they relate to WordPress?

DKIM and SPF are the two DNS-based authentication standards that let mailbox providers (Gmail, Microsoft 365, Yahoo, and everyone else) verify that mail claiming to come from your WordPress site’s domain is actually authorised to send as that domain. Neither is WordPress-specific: they are internet-standard email authentication protocols that any sending domain needs. But every WordPress site that sends outbound mail (which is every site with password resets, comment notifications, WooCommerce order emails, or contact form notifications) depends on both being correctly set up.

Mail that passes neither check can be slowed down, sent to spam or refused, depending on the mailbox provider. Passing both does not guarantee the inbox. Gmail, Yahoo and Microsoft’s consumer mail services ask more of sites that send in bulk; what each one asks for comes after the two records.

SPF: which servers are allowed to send as your domain

SPF (Sender Policy Framework) is a TXT record published on your domain’s DNS that lists the servers and services authorised to send email as @yourdomain.com. It looks like this:

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

When a mailbox provider receives a message claiming to be from your domain, it looks up the SPF record on the domain, checks whether the sending IP matches one of the authorised includes, and decides whether SPF passes or fails. The ~all at the end, which Google recommends, gives mail from any other IP a softfail: the domain says the IP is probably not authorised.

A WordPress site typically has one SPF record with multiple include: clauses, one per sending service. Your transactional email provider is one include. Google Workspace or Microsoft 365 (if your human mail lives there) is another. If your host’s own MTA is also sending mail, its include is a third.

DKIM: cryptographic signatures on every outgoing message

DKIM (DomainKeys Identified Mail) is a pair of DNS records on a provider-specific subdomain that publishes the public half of a cryptographic signing key. The provider signs every outgoing message with the private half; the mailbox receiving the message fetches your public key and verifies the signature.

The record lives at a subdomain that the provider tells you to use, typically something like s1._domainkey.yourdomain.com, and the contents contain the public key material:

v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...

The key exchange happens on every message. If a message was altered in transit, or came from someone who does not hold the private key, DKIM fails and the message is treated as unauthenticated. DKIM is what proves the mail actually came from a service authorised to sign as your domain, rather than a spammer who happened to spoof the From header.

How they relate to WordPress specifically

Without a mailer plugin, WordPress gives each message to your web host to send. The sender address recipients see is wordpress@ plus the site’s host name, unless a plugin, a theme or the code sending the message changes it. Whether the message passes SPF or DKIM depends on how the host sends it, which WordPress does not control. To find out, send yourself a test message and read the Authentication-Results header on the copy that arrives.

WordPress sends through a function called wp_mail(), which by default passes the message to PHP and on to the host’s mail transport agent, the server software that delivers it. For SPF, the receiver checks the IP address that connects to it against the SPF record of the domain in the envelope sender, the return address given during delivery (SMTP MAIL FROM in RFC 7208 §§2.4, 4.1). The envelope sender’s domain can differ from the one in the From address, and the default From address tells you neither that domain nor the delivering IP. The host or a relay may also add a DKIM signature.

A mailer plugin (FluentSMTP, WP Mail SMTP, Post SMTP) replaces that path with an authenticated connection to a transactional email provider (Postmark, SMTP2GO, Amazon SES, Brevo, and so on). The provider signs the outgoing message with a DKIM key aligned to your domain, and the provider’s sending IPs are covered by the SPF include you publish. Now the mail authenticates correctly: SPF passes because the IP is in your record, DKIM passes because the signature verifies against your public key, and the mail arrives at Gmail or Microsoft 365 with both checks green.

Every provider’s onboarding tells you exactly which SPF include to publish and which DKIM records to add. Copy the values from the provider’s admin panel into your domain’s DNS.

What happens if only one is set up

Gmail and Yahoo ask all senders to set up SPF or DKIM, and ask bulk senders to set up both. Outlook.com and related Microsoft consumer mail services require bulk senders sending 5,000 or more messages a day to publish SPF and DKIM records, pass both checks, publish a DMARC (Domain-based Message Authentication, Reporting, and Conformance) is a DNS TXT record that tells receivers what to do with mail from your domain that fails SPF or DKIM, and where to send reports about those failures. Read full reference → record, and pass DMARC with at least one of SPF or DKIM aligned with the From domain.

  • SPF alone. Mail authenticates but a forwarding hop (an intermediate mail server relaying the message) can break SPF because the sending IP changes. Gmail’s post-February-2024 rules require every sender to set up SPF or DKIM; bulk senders (more than 5,000 messages a day to personal Gmail accounts) need both, with one of them aligned to the From domain. SPF-only is fragile. DKIM survives forwarding because the signature is on the message itself.
  • DKIM alone. This meets the minimum Gmail and Yahoo set for all senders, SPF or DKIM. It does not meet either provider’s bulk-sender requirements, which ask for both SPF and DKIM.
  • Neither. Gmail lists two replies for mail where neither passes: 421 4.7.26, which rate limits it, and 550 5.7.26, which blocks it (Google’s error list). Yahoo says mail that does not meet its requirements may go to the spam folder or be rejected, with an error code if it is rejected (Yahoo’s sender FAQ). In Microsoft 365, a message that fails composite authentication is not automatically blocked; if spoof intelligence marks the sender as suspicious, the anti-phishing policy moves the message to Junk or quarantines it (Microsoft’s anti-spoofing documentation).

Publishing both is a five-minute job at your domain registrar. Do it once, verify with the provider’s admin panel that both show green, and the WordPress site’s mail authenticates correctly forever after.

The extended guide, and the sending side

For the full DNS setup with DMARC layered on top, see How to set up DNS for WordPress email: SPF, DKIM, DMARC. For the per-plugin, per-provider fix checklist that turns the failing record green, see WordPress SPF, DKIM, and DMARC setup: the per-plugin, per-provider checklist. For whether Gmail’s post-February-2024 bulk-sender rules apply to the site at all, see Gmail and Yahoo bulk-sender rules for WordPress. For the sending-side of the equation (choosing a provider, configuring the mailer plugin), see How can WordPress send emails under my own domain name? and WordPress email setup: the complete guide.

Corrections
  • 2026-11-26: an earlier version’s example SPF record used spf.mailgun.org, which publishes no SPF record; Mailgun’s include is mailgun.org. The example also ended in -all, and the page said -all tells receivers to reject mail from an IP not on the list. Receivers decide what to do with an SPF fail, and Google recommends ~all.
  • 2026-11-25: an earlier version said mail with neither SPF nor DKIM is rejected at Gmail, junked at Microsoft 365 and silently dropped at Yahoo, and that both records put mail in the inbox. Google lists a deferral as well as a block, Yahoo says spam folder or rejection with an error code, and Microsoft does not block on failed authentication alone. It also said a message sent without a mailer plugin carries the host’s From address; WordPress defaults it to wordpress@ plus the site’s host name.
  • 2026-11-25: an earlier version said Gmail’s rules require SPF or DKIM to pass with domain alignment. Google asks all senders for SPF or DKIM; the alignment rule is for senders of more than 5,000 messages a day.