DMARC Monitor

DKIM fail: the five reasons it fails and how to find yours

By Matt Pritchett · · 6 min read

A DKIM fail means the message was signed, but the signature didn't check out against the public key in your DNS. That is different from dkim=none, which means the message wasn't signed at all. Both stop DKIM from helping your mail, but they have different fixes, so the first step is to see which one you have and which key the message was signed with. Then you can match it to one of five causes.

What DKIM checks

DKIM is a signature on each email. Your mail server or sending service signs the message with a private key and adds a DKIM-Signature header. The receiving server looks up the matching public key in your DNS and tests the signature. If the key isn't there, can't be read, or the message changed after it was signed, DKIM fails.

The result the receiver writes down is one word. The standard for these results, RFC 8601, defines the ones you will see:

  • none: the message was not signed.
  • fail: the message was signed, but the signature failed verification.
  • neutral: the signature had syntax errors or could not be processed.
  • temperror: a temporary problem, such as not being able to fetch the public key. A later attempt may work.
  • permerror: an error that won't go away on a retry, such as a required header field being absent.

Find the result and the selector in the header

Open the message in the mailbox that received it, not your sent folder: the receiving server adds the results.

  • Gmail: open the message, three-dot menu, Show original.
  • Outlook on the web: open the message, three-dot menu, View, View message details.
  • Outlook for Windows: open the message, File, Properties, and read the Internet headers box.

Find two lines. Authentication-Results has the dkim= result. DKIM-Signature has the two tags you need: d= is the signing domain and s= is the selector, the label that says which key was used. The public key should be in DNS at the selector, then ._domainkey., then the domain. With s=google and d=yourshop.com, that is google._domainkey.yourshop.com.

If reading headers by eye isn't your thing, paste the whole header into the email header analyzer. It reads the selector and whether DKIM passed.

Reason 1: DKIM was never turned on

Result: dkim=none, and there is no DKIM-Signature line, or only one from your provider's own domain.

Most providers don't sign with your domain until you turn it on and publish their record. Where the common senders put it:

  • Google Workspace: selector google. A TXT record you generate in the Admin console under Apps, Google Workspace, Gmail, Authenticate email.
  • Microsoft 365: selector1 and selector2. Two CNAMEs that point to onmicrosoft.com. Turn DKIM on in the Defender portal, Email authentication settings.
  • Mailchimp: k1 (and k2, k3), as CNAME records.
  • SendGrid: s1 and s2, as CNAME records.
  • SendWP: sendwp.

Publish the record the provider gives you exactly as it gives it, then turn signing on in the provider. If you run your own server, the DKIM record generator makes a key pair and the record to publish.

Reason 2: no key at the selector the message names

Result: dkim=fail or permerror, and the message does have a DKIM-Signature.

The receiver looked for the key at the s= selector and found nothing. Usually the record was published at the wrong host name, the selector was mistyped, or the provider signs with a different selector than the one you set up. Check the spelling against the s= tag, and that the record is at selector._domainkey.yourdomain.com. A common slip is a DNS host that adds your domain to the end of what you type, so the record ends up at google._domainkey.yourshop.com.yourshop.com.

Reason 3: the key in DNS is broken, revoked or out of date

Result: dkim=fail, and a key does exist at the selector.

Three things go wrong with the key itself:

  • It was pasted with quotes or line breaks, or the p= value was cut off. Copy it again from your provider and paste it whole.
  • It has an empty p=, which means the key was revoked. That is fine for a selector you no longer sign with. If you still sign with it, publish the current key.
  • The provider rotated its key, or you set up a new account, and DNS still has the old one. The message is signed with a key that no longer matches. Publish the key the provider shows now.

RSA keys under 1024 bits are also a problem: receivers treat them as unsigned. If yours is that short, make a new 2048-bit key, publish it at a new selector, switch signing to it, then retire the old one.

Reason 4: the message changed after it was signed

Result: dkim=fail on some messages and dkim=pass on others from the same sender.

DKIM signs the headers and the body. If anything changes them on the way, the signature no longer matches. Mailing lists are the usual cause: RFC 7960 lists adding a footer to the email body and prepending a tag to the subject among the changes lists make, and says any such modifications would invalidate a DKIM signature. Some forwarding services and security gateways that rewrite links or add a banner do the same.

You can't fix this on your side for mail someone else changes. If a tool you control adds a footer or banner after signing, move that step before the signature, or have the tool sign after it.

Reason 5: DKIM passes, but for the wrong domain

Result: dkim=pass, yet DMARC fails.

The signature is valid, but d= is your sender's domain, not yours. Many services sign with their own key until you set up custom DKIM. DKIM is fine here. DMARC fails because it needs the d= domain to match your From domain. The fix is the same as reason 1: set up custom DKIM at that sender so it signs as your domain.

If your result is temperror, it was most likely a DNS timeout. A resend usually clears it.

What to send your provider or IT person

If someone else manages your DNS or your sending service, this saves a round of emails:

"Our emails from [address] are failing DKIM. The header shows dkim=[result] with d=[domain] and s=[selector]. Can you confirm DKIM signing is turned on for our domain, and send the exact DNS record (host name and value) for that selector? We'll publish it and test again."

Fill the brackets from the header. If the provider has no way to sign as your domain, that sender will never pass DKIM for you, and it is worth moving that mail to one that can.

When you have more than one sender

A domain often has several: your mailbox provider, a newsletter tool, a store or a CRM, each with its own selector. One header only tells you about one of them. Your DMARC reports name every source and whether its DKIM passed, and the DMARC XML report reader turns them into plain English. The SPF record examples cover the SPF side for the same senders.

Check your DKIM now

Run the free DKIM checker on your domain. We try 29 common selectors, so you don't need to know yours, and you can add the one from your s= tag. It tests each key's type, length and whether it has been retired, and tells you what to fix. It only reads public DNS records.

Written by The DMARC Monitor Team, assisted by Friday.