DKIM: DomainKeys Identified Mail
DKIM cryptographically signs every outbound message with a private key; receivers verify the signature against your public key in DNS. Survives forwarding, unlike SPF.
TL;DR
- Publish your public key in DNS at <selector>._domainkey.<your-domain>.
- Your sending server signs messages with the matching private key.
- Receivers verify the signature; tampered or forged messages fail.
What it does
DKIM proves that a message wasn't tampered with in transit and that it was authorised by the holder of your domain's private key. The sending server adds a DKIM-Signature header that includes a hash of selected parts of the message; receivers reproduce the hash and verify it against your published public key.
Crucially, the DKIM signature travels with the message. When a recipient forwards your email, the DKIM signature still validates at the next hop (assuming the forwarder doesn't rewrite the body). That makes DKIM the protocol that DMARC alignment relies on for forwarded mail.
Each ESP signs with their own key, so you publish multiple selectors (one per sender). Modern ESPs auto-rotate keys via CNAME records you publish.
How it works
- Generate a 2048-bit RSA key pair (or have your ESP do it).
- Publish the public key as a TXT record at <selector>._domainkey.<your-domain>.
- Configure your sending server / ESP to sign every outbound message with the matching private key.
- Receivers retrieve the public key via the DKIM-Signature header's d= and s= tags, hash the message body + headers per the algorithm, and compare to the included signature.
- A pass result feeds DMARC alignment; a fail flags the message.
Example record
google._domainkey.yourdomain.com TXT
Common pitfalls
- Using 1024-bit keys (vulnerable to factorization). Industry standard since 2018 is 2048-bit. Some legacy ESPs still default to 1024; rotate to 2048.
- Forgetting that mailing-list managers rewrite message bodies, breaking DKIM. The fix is ARC (Authenticated Received Chain), not a DKIM tweak.
- Not rotating keys periodically. Once a private key is compromised, every signed message is forgeable. Rotate annually at minimum.
- Multiple TXT entries on the same selector — only the first is honoured, rest are ignored. Use a single TXT split across quoted strings if needed.
Related tools
Want PhishFence to monitor DKIM for your domains?
Sign up free, add a domain, and PhishFence will continuously check DKIM (and the rest of the email-auth stack) for you.