DKIM shows 'bad version' or 'unknown key type' because the DNS key record is malformed
dkim=neutral (bad version)Short answer
These results mean the receiver found your DKIM key record but could not use it. The record must start with v=DKIM1 exactly, use a key type the verifier knows, such as k=rsa, carry the public key in p=, and be the only record at the selector. A bad paste into DNS is the usual cause.
Fix it fast
1Find out which cause you have
Fetch the key record exactly as the receiver sees it. The name is selector, then _domainkey, then your domain.
dig +short TXT selector1._domainkey.example.com2Match what you see, then jump to its fix
- 1
The answer begins with something other than v=DKIM1, such as a typo, a different value or the key tags first.The version tag is not exactly DKIM1, or is not firstFix - 2
dkim=fail (unknown key type) while the version looks right.The key type tag has a value the verifier does not recogniseFix - 3
The p= value is empty, ends early, or contains spaces and quotes from a bad copy.p= is empty, truncated or pasted with extra charactersFix - 4
dig returns two or more answers for the selector name.More than one TXT record exists at the selectorFix
- 1
What does the error look like?
dkim=neutral (bad version)dkim=fail (unknown key type)
Cause 1 of 4
The version tag is not exactly DKIM1, or is not first
1Check
RFC 6376 says v=, if present, must be DKIM1 and must be the first tag. Records with any other value are discarded, and the comparison is exact, so DKIM1.0 is not accepted.
dig +short TXT selector1._domainkey.example.com | head -c 802Fix
Rewrite the record so it begins with v=DKIM1; followed by the other tags.
selector1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq...IDAQAB"3Verify
dig shows a record starting v=DKIM1, and a new test message shows dkim=pass.
dig +short TXT selector1._domainkey.example.comConfirmed by rfc-editor.org
Cause 2 of 4
The key type tag has a value the verifier does not recognise
1Check
k= is optional and defaults to rsa. An unrecognised key type makes the key unusable.
dig +short TXT selector1._domainkey.example.com2Fix
Use k=rsa, or remove the k= tag so the default applies, and make sure p= holds the public key your signer actually uses.
"v=DKIM1; k=rsa; p=PUBLIC_KEY_BASE64"3Verify
The next test message shows dkim=pass at Gmail and Yahoo.
dig +short TXT selector1._domainkey.example.comConfirmed by rfc-editor.org
Cause 3 of 4
p= is empty, truncated or pasted with extra characters
1Check
p= is required and holds the base64 public key. An empty value means the key has been revoked. Long keys are split into several quoted strings in DNS, and the strings are joined without added spaces.
dig +short TXT selector1._domainkey.example.com | wc -c2Fix
Publish the full key again from the file your signer generated, as one record. Keep quotes only around each string, with no extra spaces inside the key.
selector1._domainkey.example.com. IN TXT ( "v=DKIM1; k=rsa; "
"p=MIIBIjANBgkq...first part"
"second part...IDAQAB" )3Verify
The joined answer is one complete key, and dkim=pass appears.
dig +short TXT selector1._domainkey.example.comConfirmed by rfc-editor.org
Cause 4 of 4
More than one TXT record exists at the selector
1Check
RFC 6376 says the record set for a selector should contain only one record, and with several the results are undefined.
dig +short TXT selector1._domainkey.example.com2Fix
Delete the old or duplicate records, leaving only the current key.
; keep only one TXT record at selector1._domainkey3Verify
dig returns exactly one answer.
dig +short TXT selector1._domainkey.example.com | wc -lConfirmed by rfc-editor.org
How do I stop it coming back?
- Copy the record from the signer's generated file or the provider's screen, not by retyping.
- Give every new key a new selector and remove the old record after the switch.
- Send a test message to a Gmail and a Yahoo address and read the authentication result before turning on a strict DMARC policy.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Gmail rejects your mail with 550 5.7.26: no authentication information
rejected with a 5.7.26 error
Gmail returns 5.7.26 when a message is not authenticated.
4 causes, each with a fixCodeIgniter email does not send and shows no error message
$email->printDebugger() prints an empty result
CodeIgniter signals a failed email only by send() returning false, with no exception.
4 causes, each with a fixDjango send_mail fails or hangs with an SSL error
smtplib.SMTPException raised from send_mail()
Django has two secure modes that must not be mixed: EMAIL_USE_TLS for explicit TLS (STARTTLS, usually port 587) and EMAIL_USE_SSL for implicit TLS (usually port 465).
4 causes, each with a fixSmtpException: Unable to read data from the transport connection (net_io_connectionclosed)
System.Net.Mail.SmtpException: Unable to read data from the transport connection: net_io_connectionclosed.
The server closed the connection while SmtpClient was waiting for a reply.
4 causes, each with a fixDovecot refuses to start: Can't load SSL certificate, no valid PEM certificate
doveconf: Error: ssl enabled, but ssl_cert not set
Dovecot reads the ssl_cert setting as the file's contents, not a path, so in 2.3 the value must start with a less-than sign.
3 causes, each with a fixMail from your own domain keeps landing in the spam folder
dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=example.com
Open a message that went to spam and read its Authentication-Results header: it shows whether SPF, DKIM and DMARC passed, and for which domain.
5 causes, each with a fix