Table of Contents

DKIM (DomainKeys Identified Mail)

DomainKeys Identified Mail (DKIM) is an email authentication standard that uses digital signatures to verify that an email was authorized by the sending domain and that its contents have not been modified during transmission.

Unlike SPF, which verifies the sending server, DKIM verifies the integrity and authenticity of the message itself.


Why Is DKIM Needed?

Emails often pass through multiple mail servers before reaching the recipient.

During this journey, an attacker could attempt to modify the message.

DKIM allows the receiving mail server to detect whether the email has been altered.


How DKIM Works

DKIM uses public-key cryptography.

The sending mail server:

The receiving server:


Simplified Process

Mail Server

↓

Create Digital Signature

↓

Private Key

↓

Email Sent

↓

Recipient Server

↓

Retrieve Public Key from DNS

↓

Verify Signature

If verification succeeds, the message passes DKIM.


Public Key in DNS

The public key is stored as a DNS TXT record.

Example:

selector1._domainkey.example.com

Typical record:

v=DKIM1;
k=rsa;
p=MIIBIjANBgkqh...

The receiving server queries this DNS record to obtain the public key.


What Is a Selector?

A selector identifies which DKIM key was used.

Example:

selector1._domainkey.example.com

Another selector might be:

mail2026._domainkey.example.com

Selectors make it possible to rotate keys without interrupting email delivery.


DKIM-Signature Header

A DKIM-signed email contains a header similar to:

DKIM-Signature:
v=1;
a=rsa-sha256;
d=example.com;
s=selector1;
bh=...;
b=...

Common fields:

Field Meaning
v DKIM version
a Signing algorithm
d Signing domain
s Selector
bh Body hash
b Digital signature

DKIM Results

Mail servers usually report one of these results:

Result Meaning
Pass Signature verified successfully
Fail Signature verification failed
None No DKIM signature present
TempError Temporary DNS problem
PermError Invalid DKIM signature or record

What Does DKIM Protect?

DKIM helps verify:

It does not:


DKIM and Email Forwarding

Unlike SPF, DKIM usually survives email forwarding because the digital signature remains valid as long as the signed portions of the message are not modified.

However, if a forwarding service changes the signed headers or body (for example by adding a disclaimer), DKIM verification may fail.


DKIM and Telenegar

The Telenegar Mail Check service can verify:

This helps improve email authentication and deliverability.


SPF vs DKIM

SPF DKIM
Verifies the sending server Verifies the email signature
Uses sender IP address Uses public/private keys
May fail after forwarding Usually survives forwarding
Stored as DNS TXT record Public key stored as DNS TXT record

Both technologies complement each other.


Common Misconceptions


Best Practices



email dkim dns authentication smtp mail security