DKIM Troubleshooting Guide
DKIM (DomainKeys Identified Mail) failures can be tricky to diagnose because they involve cryptographic signatures and DNS records. This guide covers the most common DKIM issues and how to resolve them.
Issue: DKIM Key Not Found
Symptoms
- DKIM returns
permerrororneutral - Error message says "No key found" or "DNS query failed"
- DKIM signature is present but verification fails
Causes
- Wrong selector — The selector in the signature doesn't match what's in DNS
- Missing DNS record — The public key hasn't been published
- Propagation delay — A new DNS record hasn't propagated yet
Solution
- Find the selector from the email headers:
DKIM-Signature: ... s=selector1; d=example.com; ...
- Verify the DNS record exists:
nslookup -type=txt selector1._domainkey.example.com
- If missing, add the DKIM public key to DNS:
selector1._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIGfMA0..."
- Wait for propagation if newly added (see DNS Propagation)
Issue: DKIM Signature Invalid
Symptoms
- DKIM returns
fail - Error message says "Signature verification failed" or "Body hash mismatch"
Common Causes
Email gateways that modify content after signing:
- Security scanning that adds headers or footers
- Disclaimer text appended to the message body
- Character encoding changes
Mailing lists that modify messages:
- Subject line prefixes (e.g.,
[listname]) - Footer additions
- Reply-to header modifications
Solutions
For email gateways:
- Configure the gateway to preserve DKIM signatures
- Or arrange for re-signing after modification
For mailing lists:
- Accept that DKIM will fail on forwarded mail from lists
- Rely on the mailing list's own authentication
- Use ARC (Authenticated Received Chain) if supported
Issue: DKIM Not Enabled
Symptoms
- No DKIM signature in outgoing emails
- DKIM returns
none - DMARC failing due to missing DKIM authentication
Solution
Enable DKIM signing in your email service:
Google Workspace:
- Admin Console → Apps → Google Workspace → Gmail
- Authenticate email → Generate new record
- Add the TXT record to DNS
- Start authentication
Microsoft 365:
- Microsoft 365 Defender → Email & collaboration
- Policies & rules → Threat policies → Email authentication
- Enable DKIM signing for your domain
SendGrid:
- Settings → Sender Authentication
- Authenticate Your Domain
- Follow the DNS setup instructions
Mailchimp:
- Account → Settings → Domains
- Verify & Authenticate
- Add the DKIM record to DNS
Issue: DKIM Alignment Failure
Symptoms
- DKIM passes but DMARC still fails
- The alignment check fails specifically
- Different domains in the DKIM signature and From header
Cause
The d= domain in the DKIM signature doesn't match the From header domain:
From: sales@example.com
DKIM-Signature: d=thirdparty.com ...
Solution
Configure the sending service to sign with your domain:
- Find custom DKIM settings in your email service
- Generate keys for your domain instead of the service's domain
- Add the public key to your domain's DNS
- Verify the signature now uses your domain's
d=value
Correct alignment:
From: sales@example.com
DKIM-Signature: d=example.com ...
Issue: DKIM Key Size Too Small
Symptoms
- DKIM verification fails with a security error
- "Key too small" or "weak key" errors
- Works with some receivers but fails with others
Cause
DKIM key is 512 bits or smaller. Many receivers now require 1024-bit or larger keys.
Solution
- Generate a new 2048-bit RSA key pair
- Update DNS with the new public key
- Configure your email service with the new private key
- Test and verify the new key works
- Remove the old DNS record after confirming
Note: Some DNS providers have TXT record length limits. For 2048-bit keys, you may need to split the record into multiple strings.
Issue: DKIM Record Syntax Errors
Common Errors
Missing version tag:
# Wrong
k=rsa; p=MIGfMA0...
# Correct
v=DKIM1; k=rsa; p=MIGfMA0...
Truncated public key:
# Wrong (incomplete)
v=DKIM1; k=rsa; p=MIGfMA0
# Correct (complete key)
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQ...
Invalid characters or formatting:
# Wrong (extra spaces around semicolons)
v=DKIM1 ; k=rsa ; p=MIGfMA0...
# Correct
v=DKIM1; k=rsa; p=MIGfMA0...
Diagnostic Steps
- Check email headers for the
DKIM-Signatureheader - Extract the selector and domain from the signature (
s=andd=tags) - Query DNS for the public key at
selector._domainkey.domain.com - Validate key format using online tools
- Review DMARC reports for DKIM failure patterns across sending sources
Prevention Tips
- Use 2048-bit keys for all new DKIM implementations
- Document selectors and which service uses which selector
- Test after changes before announcing success
- Monitor DMARC reports for DKIM failure trends
- Plan key rotation procedures in advance
Next Steps
- Learn how DKIM works in detail
- Understand alignment modes and their impact on DKIM
- Verify your DKIM records with our free DKIM Checker