When your server sends a message, it signs selected headers and the body with a private key. The receiver reads the DKIM-Signature header, fetches the matching public key from DNS, and recomputes the signature. If the key is wrong or the message changed on the way, the result is dkim=fail. Gmail sometimes shows the same problem as dkim=neutral (body hash did not verify).
DKIM is one of the two checks DMARC relies on, so a failure here often appears together with a DMARC fail when SPF isn’t aligned either.
Causes
- The DKIM record is missing or has the wrong name. The key must live at
<selector>._domainkey.<domain>. - The key was pasted incorrectly: cut off, with extra spaces or quotes, or split badly. 2048-bit keys are longer than one DNS string, so the value must stay complete inside one TXT record.
- You moved mail to a new server. The new server signs with its own private key while DNS still publishes the old server’s public key, a common problem when DNS is hosted elsewhere (Cloudflare or the registrar).
- DNS hasn’t propagated yet after you added or changed the key.
- The message was modified after signing by a mailing list, a forwarding service, an antivirus gateway adding a disclaimer, or a security tool rewriting links.
How to fix it
-
Read the signature in the headers. In Gmail choose Show original and find the
DKIM-Signatureline. Noted=(the signing domain) ands=(the selector). -
Look up the published key. Use the TXT lookup tool on
default._domainkey.example.com, or:dig +short TXT default._domainkey.example.comThe answer should start with
v=DKIM1; k=rsa; p=followed by a long string. -
Compare it with the key your server signs with. In cPanel open Email → Email Deliverability. If it reports a problem for the domain, use Repair when the domain’s DNS is on this server, or Manage to copy the exact record into the DNS provider you use.
-
Paste the whole value in your DNS provider’s TXT field without adding quotes or line breaks yourself; most panels split long values automatically. Look up the record again and make sure the
p=value isn’t cut short. -
After a migration, replace the old key with the new server’s key on the same day you switch MX.
-
Wait for the TTL, send a new test message to a Gmail address, and check that Show original reports
DKIM: 'PASS' with domain example.com. -
If only forwarded or list mail fails, there’s nothing to fix in your DNS. Make sure SPF is correct so DMARC can still pass on direct mail.
Prevention
- Check DKIM with Email Deliverability after any move, DNS change or new sending service.
- Keep DNS in one place where you can see all mail records together.
- For third-party services that send as your domain, enable their own DKIM setup so they sign with your domain, not theirs.
Follow the SPF, DKIM and DMARC setup guide to set all three records in order.
On ArabyHost
For domains on ns1.arabicode.com and ns2.arabicode.com, ArabyHost creates the DKIM key and its DNS record automatically, so new mailboxes sign correctly from the first message. If your DNS is managed somewhere else, copy the record from cPanel → Email Deliverability into that DNS provider. Moving mail from another host? Our free migration help covers the DNS switch, including DKIM.
FAQ
What's the difference between dkim=fail and dkim=none?
`dkim=none` means the message wasn't signed at all. `dkim=fail` means it was signed, but the signature didn't match the key in DNS or the message changed afterwards.
Why does DKIM fail only for messages sent through a mailing list?
Many lists add a footer or a tag to the subject, which changes the signed content. That's expected and not something your DNS can fix; DMARC can still pass through SPF or the list's own signature.
What is the DKIM selector?
It's the name that tells receivers where to find the key: `s=default` in the signature means the key is at `default._domainkey.example.com`. cPanel uses the selector `default`.