Why DKIM verification fails (and how to fix each cause)

A signed email whose DKIM key points to a selector record that DNS doesn't publish, so the lookup fails

DKIM verification fails for four main reasons: the selector in the message header doesn't match a published DNS record, the public key was truncated when pasted, something modified the message body after signing, or the record was added with the wrong host. Query the selector directly with dig TXT selector._domainkey.yourdomain.com to tell which.

Unitpost ·

DKIM signs each message with a private key. You publish the matching public key in DNS, and the receiver fetches it to check the signature. A valid signature shows the message is authentic and wasn't changed on the way. A failed check is worse than having no DKIM at all, because to the receiver it looks like tampering.

Find the selector, then query it

Every DKIM signature names its own selector. Open the raw source of a message you received and find the DKIM-Signature header. The s= tag is the selector and d= is the signing domain. Query that exact record:

Bash
# From the DKIM-Signature header: s=selector1; d=yourdomain.com
dig TXT selector1._domainkey.yourdomain.com +short

If the query returns nothing, the record isn't where the signature says it is. That's cause 1 or cause 3 below.

Cause 1: selector mismatch

A domain can publish several keys, each under its own selector. After a key rotation, or after copying a record from another provider's instructions, mail can go out signed with a selector that has no record in DNS. Publish the record for the selector named in the s= tag. Nothing about the signature needs to change.

Cause 2: the public key was truncated

A 2048-bit public key is longer than 255 characters, the limit for a single TXT string. Some DNS dashboards cut the value off without warning. Others make you split it into several quoted strings, which resolvers join back together.

A truncated key still resolves, so the record looks fine in dig and fails every check. This is the most confusing version of the failure. Unitpost's domain check reports it as "The DKIM value at selector._domainkey.yourdomain.com is incomplete. Copy it again."

Compare lengths

Compare the p= value in DNS with the one you were given, character by character. If the DNS copy is shorter, it was cut off. Several quoted strings inside one record is correct. Several separate TXT records is wrong.

Cause 3: wrong host field

The record belongs at selector._domainkey. Many DNS hosts append your domain to whatever you type, so entering the full name creates selector._domainkey.yourdomain.com.yourdomain.com. Query the record to see where it landed instead of trusting the DNS dashboard.

Unitpost looks for the doubled name and tells you directly: "Your DNS host added yourdomain.com to the DKIM name", followed by the name to use instead.

Cause 4: the message changed after signing

The signature covers a hash of the body and selected headers. If either changes after signing, the hash no longer matches. The usual causes are a mailing list that appends a footer, a security appliance that rewrites links, and forwarding rules.

If mail you send directly verifies but forwarded copies fail, this is the reason. You can't fix it from the sending side.

Rotating a DKIM key without downtime

Rotation is where teams cause their own outages. If you delete the old record as soon as you switch signing, mail that is still in flight, signed with the old key, fails verification. The safe order is make-before-break:

  1. Publish the new key under a new selector.
  2. Query it and confirm it resolves.
  3. Switch signing to the new selector.
  4. Remove the old record once no mail is signed with it.

Frequently asked questions

Can I have multiple DKIM records?

Yes, as long as each has its own selector. Each record lives at its own selector._domainkey host, so they don't conflict the way two SPF records do. You need two during a key rotation: keep the old selector published until nothing is signed with it, and the switch causes no failures.

Why does DKIM pass for direct mail but fail when forwarded?

Forwarding often changes the message. A mailing list that adds a footer, or a security gateway that rewrites URLs, changes the body after it was signed, so the hash no longer matches. This is a known limitation of DKIM, and you can't fix it from the sending side.

Is a 1024-bit DKIM key still acceptable?

It still validates, but 2048-bit is the current recommendation and what major mailbox providers expect from bulk senders. 1024-bit keys persist mostly because a 2048-bit key is longer than the 255-character limit of a single TXT string, and some DNS dashboards handle that badly.

Send email your users actually receive

5,000 emails a month free — API, SMTP, templates, tracking. No credit card.