TechBuzzPro

DKIM and Email: What It Is and How It Works

· 6 min read · Apps & Browsers

In this article
  1. Background: Why DKIM Exists
  2. How DKIM Works: Signing and Verification
  3. What DKIM Does and Does Not Protect
  4. Setting Up DKIM: What Administrators Do
  5. Common DKIM Problems and How to Diagnose Them
  6. DKIM Compared with SPF and DMARC
  7. Frequently Asked Questions

DKIM (DomainKeys Identified Mail) is an email authentication standard that lets a receiving mail server verify that an email claiming to come from a domain was actually authorized by that domain and was not altered in transit. It does this by attaching a cryptographic signature to the message headers. DKIM is not a slang word or informal term; it is a technical acronym defined in IETF standards (originally RFC 4871, later updated by RFC 6376). In everyday use, you will see it in email headers, in DNS records, and in deliverability discussions: "The newsletter landed in spam because its DKIM signature was missing."

Background: Why DKIM Exists

Email was designed without built-in sender authentication. Anyone can put any From address on a message. That made spoofing, phishing, and spam easy. DKIM was created to give receiving servers a way to check that a message really came from the domain it claims and that nothing changed along the way. It was published as a standard in 2007 and is now one of the three pillars of email authentication, alongside SPF (Sender Policy Framework) and DMARC (Domain-based Message Authentication, Reporting, and Conformance).

DKIM does not encrypt email. It signs it. The signature proves integrity and domain authorization, not confidentiality. A signed message can still be read by anyone who intercepts it unless the transport is separately encrypted (for example, with TLS between servers).

How DKIM Works: Signing and Verification

DKIM uses public-key cryptography. The sending domain publishes a public key in DNS. The sending mail server signs selected headers and the body with the matching private key. The receiving server looks up the public key and checks the signature.

  1. Key generation. The domain owner creates a public/private key pair. The private key stays on the sending mail server or signing service; the public key is published as a DNS TXT record at a selector name such as selector1._domainkey.example.com.
  2. Signing. When a message is sent, the signing server computes a hash of the selected headers and the body, encrypts that hash with the private key, and adds a DKIM-Signature header to the message.
  3. Verification. The receiving server reads the DKIM-Signature header, extracts the domain and selector, queries DNS for the public key, and verifies that the signature matches the message content.
  4. Result. The receiver records a result such as pass, fail, neutral, or temperror. A pass means the signature is valid and the signed content was not modified.

The signature header includes several tags: v=1 (version), a= (algorithm, commonly rsa-sha256), d= (signing domain), s= (selector), h= (signed headers), bh= (body hash), and b= (the signature itself). You can see these in a message's full headers in most email clients by choosing "Show original" or "View source."

What DKIM Does and Does Not Protect

DKIM protects the integrity of the signed parts of a message and ties the message to a domain that controls the private key. It does not by itself tell the receiver whether to trust that domain, and it does not stop all spoofing. A message can have a valid DKIM signature from a domain that is not the visible From domain, which is why DKIM is paired with SPF and DMARC.

  • Protects: signed headers and body from modification in transit; domain authorization for the signing domain.
  • Does not protect: unsigned headers (which can be added or altered), confidentiality, or the reputation of the domain.
  • Does not replace: SPF (which checks sending IP addresses) or DMARC (which tells receivers what to do when authentication fails).

A common misconception is that a DKIM pass guarantees the email is legitimate. It only guarantees the signature is valid for the signing domain. Phishing messages can carry valid DKIM signatures from domains the attacker controls.

Setting Up DKIM: What Administrators Do

Most organizations do not hand-craft DKIM records. Their email provider or gateway generates the keys and gives them DNS records to publish. The exact menu labels vary by provider and version, so treat the following as a general sequence rather than a click-by-click path.

  1. Enable DKIM signing in your email hosting or sending service's admin settings.
  2. Copy the DNS TXT record or records the service provides. They usually include a selector, a public key, and sometimes a p= value.
  3. Add those records at your DNS host exactly as given. Do not add quotes or line breaks that the provider did not include.
  4. Wait for DNS propagation, then use the provider's verification tool or an external DKIM checker to confirm the record resolves and the signature validates.
  5. If you rotate keys later, publish the new public key before switching the signer, and keep the old record until mail signed with it has expired.

Selectors let a domain have multiple keys active at once, which is useful for rotation and for separating streams such as transactional and marketing mail.

Common DKIM Problems and How to Diagnose Them

When DKIM fails, the symptom is usually spam placement or a DMARC failure report, not an error message to the sender. The cause is almost always one of a few things.

  • Missing or malformed DNS record. The selector does not resolve, or the TXT record is split incorrectly. Check with a DNS lookup tool against the exact selector in the signature.
  • Message modified in transit. A mailing list, forwarder, or security gateway that rewrites the subject or body can break the body hash. This is a frequent cause of failures on forwarded mail.
  • Key mismatch. The private key used to sign does not match the published public key, often after a rotation.
  • Expired or revoked key. The DNS record was removed while the signer still uses the key.
  • Unsigned headers that matter. If the From header is not signed, the signature may pass while the visible sender is spoofed.

To diagnose, open the full headers of a failing message, find the DKIM-Signature header, note the d= and s= values, and look up s._domainkey.d in DNS. Compare the result with what your provider says should be published.

DKIM Compared with SPF and DMARC

The three standards answer different questions, and receivers combine them.

  • SPF checks whether the sending server's IP address is authorized by the domain's DNS policy. It authenticates the envelope sender, not the visible From header.
  • DKIM checks a cryptographic signature over message content and selected headers. It authenticates a domain, which may or may not be the visible From domain.
  • DMARC ties SPF and DKIM to the visible From domain and tells receivers what to do when both fail, plus where to send reports.

In practice, a message passes DMARC if either SPF or DKIM passes with alignment to the From domain. That is why losing DKIM alone does not always cause a hard failure, but it removes one of the two paths to a pass.

Frequently Asked Questions

Is DKIM a word or just an acronym?

It is a standard technical acronym, not slang. It stands for DomainKeys Identified Mail and is defined in IETF documents. It is pronounced letter by letter, "D-K-I-M."

Does DKIM encrypt email?

No. DKIM signs messages to prove integrity and domain authorization. It does not hide the content. Encryption in transit is handled separately by TLS between mail servers.

Can I have DKIM without SPF or DMARC?

Yes, technically. DKIM can be deployed on its own. However, DMARC requires at least one of SPF or DKIM to align, and most deliverability guidance recommends all three together.

Why does my email pass DKIM but still go to spam?

Authentication is only one factor. Reputation, content, sending history, and recipient engagement also affect filtering. A DKIM pass does not guarantee inbox placement.

What is a DKIM selector?

A selector is the label that points to a specific public key in DNS, such as selector1 in selector1._domainkey.example.com. It lets a domain publish multiple keys for rotation or separate mail streams.

Does forwarding break DKIM?

It can. If a forwarder modifies the body or signed headers, the signature fails. Some forwarders re-sign messages, but many do not, which is a common reason forwarded mail fails authentication.