Skip to content
SpoofKiller
Troubleshooting

Common DKIM Errors and How to Fix Them

Truncated keys, wrong selectors, signatures that pass and still fail DMARC, and how to repair them.

Reading time
7 min read
Last updated
Updated
Rows of keys hanging on a locksmith's board, with one bright yellow key among them.
Every selector is a key on the board. Trouble starts when the hook is empty, the key is cut short, or it opens someone else's door.
In this guideShow 8 sections

DKIM is a wax seal for email. The sender presses a signature into the message, the receiver checks it against a public key in DNS, and if the two agree, the letter is genuine and unopened. It is elegant. It is also the only part of email authentication that can be perfectly configured on Monday and broken on Tuesday by a legal disclaimer.

When DKIM fails, the header tells you so in a few clipped words: dkim=fail (body hash did not verify), or dkim=neutral (no key). Those words point to a small number of causes. This guide matches each message to its cause and its repair. If the mechanics are new to you, start with What Is DKIM?

First, read the signature

Every signed message carries a header like this:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=example.com; s=mail2026;
    h=from:to:subject:date:message-id;
    bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
    b=AuUoFEfDxTDkHlLXSZEpZj79LICEps6eda7W3deTVFOk...

Three tags do most of the diagnostic work:

  • d= is the signing domain. This is what DMARC compares with your From address.
  • s= is the selector. The receiver fetches the public key from mail2026._domainkey.example.com.
  • bh= is a hash of the body. If the body changes after signing, this no longer matches.

To see these for a real message, paste its headers into the email header analyzer. Then look up the selector with the DKIM checker. Most problems are settled by those two steps.

The error messages, decoded

What the header saysWhat happenedFix
no key for signatureNothing found at the selector’s DNS namePublish the record; check the selector and hostname
key revoked or empty keyRecord exists with an empty p=Publish the current key or sign with a live selector
invalid public key / syntax errorKey truncated or malformedRe-copy the full value from the provider
body hash did not verifyBody changed after signingFind what modifies the message in transit
signature did not verify / bad signatureSigned headers changed, or wrong key publishedCheck for header rewriting; confirm key matches
key too short / insecure keyKey under 1024 bitsGenerate a 2048-bit key
dkim=pass but dmarc=failSigned by a domain that is not yoursConfigure custom-domain signing
dkim=noneMessage was not signed at allTurn on signing at the sender

Exact wording varies by receiver. The categories do not. Each is taken up below.

The key is missing

The receiver asked DNS for the key and came back empty-handed. There are four ways to arrange this.

The record was never published

Signing was switched on at the provider, and the DNS half was left for later. The provider signs faithfully; receivers find nothing. Many providers also do the reverse: they will not start signing until they detect the record, so the DNS is right and nothing is being signed.

The wrong selector

The message is signed with s=s2 and you published s1. Or you published the selector from the setup guide instead of the one your account was issued. Selectors cannot be listed from DNS. There is no way to ask a domain which ones it has, so the selector in the message header is the only reliable source.

The doubled hostname

Your DNS host appends the domain automatically, you typed the full name, and the key now lives at s1._domainkey.example.com.example.com.

A CNAME that leads nowhere

Many providers have you publish a CNAME to a key they host. If the CNAME is missing, mistyped, or routed through a CDN proxy instead of being served as plain DNS, the lookup fails. The Cloudflare DNS guide covers the proxy trap. Use the DNS propagation checker to see what resolvers actually return.

The key is damaged, revoked, or too small

A 2048-bit public key is roughly 400 characters of base64. A single TXT string holds 255. So the key must be stored as several quoted strings in one record:

mail2026._domainkey.example.com.  TXT  (
  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv1..."
  "...Xw3q9LkQIDAQAB" )

Receivers join the strings with nothing in between. Trouble comes when a DNS panel silently cuts the value at 255 characters, when a stray space or line break lands inside the key, or when someone adds a second TXT record for the remainder instead of a second string. Two separate records at one selector is an error, not a longer key.

An empty p= tag is not damage. It is a statement: this key has been revoked. Providers publish it deliberately when retiring a selector. If mail is still being signed with that selector, every signature fails.

Then there is size. Keys shorter than 1024 bits are no longer accepted by receivers, and 512-bit keys have been breakable for years. 1024 is the floor; 2048 is the recommendation. If your DNS host truly cannot store a 2048-bit key, change DNS hosts before you settle for less.

The message changed after it was signed

This is the category that produces body hash did not verify, and the key is innocent. Something between the signer and the reader edited the message. Common culprits:

  • An outbound gateway that appends a footer or legal disclaimer after the mail server has signed.
  • A security appliance that rewrites links or strips attachments.
  • A mailing list that adds a subject tag and an unsubscribe footer.
  • Antivirus software that stamps “scanned and clean” at the bottom.
  • A relay that re-encodes the body, converting line endings or character encoding.

For anything under your control, the principle is simple: sign last. Whatever modifies the message must do so before the signature is applied. If your gateway adds the disclaimer, your gateway should do the signing.

Canonicalization gives you some slack. The c= tag sets how strictly the message is compared. With relaxed/relaxed, changes in whitespace and header capitalization are forgiven. With simple, almost nothing is. Use relaxed for both header and body. It will not save you from an appended footer, and nothing will.

For mail altered by other people’s systems, such as mailing lists and forwarders, there is no fix on your side. Some failures of this kind are permanent background noise. They are also why a DMARC failure is not proof of spoofing.

A DKIM signature guarantees the message is unchanged. Email, as an institution, has never been able to leave a message alone.

DKIM passes and DMARC still fails

The most confusing result of all looks like this:

Authentication-Results: mx.example.net;
    dkim=pass header.d=mailer-service.example;
    dmarc=fail header.from=yourcompany.com

The signature is valid. It was made by your email platform, using the platform’s own domain. DMARC does not ask whether a signature passed. It asks whether a signature passed for the domain in the From line. A pass for someone else’s domain counts for nothing.

The fix is in the platform’s settings, usually called domain authentication, custom DKIM, or a verified sending domain. You publish a key or CNAMEs under your own domain, and the platform starts signing with d=yourcompany.com. The provider guides for SendGrid and Postmark show the pattern, and DMARC Alignment Explained gives the rule in full.

A message may carry more than one signature. If one of them is yours and passes, DMARC is satisfied, and the provider’s extra signature is harmless.

Three quieter mistakes

  • Test mode left on. A t=y flag in the key record tells receivers the domain is still testing DKIM. Some will discount the signature. Remove it once signing works.
  • The l= tag. It signs only the first so many bytes of the body. Anything appended after that point is unsigned yet appears to be covered. It is a known weakness. Do not use it.
  • Expired signatures. The optional x= tag sets an expiry time. Mail delayed in a queue past that time fails, as does any message signed by a server whose clock is wrong.

Rotation without breakage, and watching for the next failure

Keys should be rotated, and rotation is when careful setups break. The safe order: publish the new selector, confirm it resolves, switch signing to it, and leave the old key published for a week or so while mail signed with it is still in transit. Only then revoke the old one.

DKIM failures do not announce themselves. Mail keeps flowing, SPF may cover for it, and you find out when a policy change or a forwarded message exposes the gap. Aggregate reports show DKIM results per sender; Understanding DMARC Reports explains how to read them. SpoofKiller’s DKIM monitoring checks the selectors you supply, along with common provider selectors, for missing, weak, or revoked keys, and uses your reports to show whether signatures are aligning in practice.

FAQ

Questions about Common DKIM Errors

Short answers to what readers ask next. If yours is missing, write to us and a person will reply.

Ask a question

Free, no obligation

Want a second pair of eyes on your records?

Send us your domain. We will look at its DMARC, SPF, and DKIM setup and write back, in plain English, with what we found and what to fix first.

  • A person reads your records, not a script
  • Specific fixes, in order of importance
  • No sales sequence afterward

We use your details to reply. Nothing else.

Reading about it is the slow way.

Run the free check and see your own domain's DMARC, SPF, and DKIM in the time it took to read this paragraph. No account, no card.