New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Domains and DNSUpdated 26 Oct 2026

Which Headers to Sign in DKIM: The h= Tag, Oversigning and Why Signatures Break

How the DKIM h= tag works, which headers to sign and which to leave out, oversigning to prevent header addition, relaxed vs simple canonicalization, why forwarding and lists break signatures and how to audit your configuration.

IR
Written by Ishita Rao
Email Authentication Engineer
Reviewed by Camille Laurent
  • Published5 Feb 2025
  • Read time6 min
  • Length1,254 words
Share this guide

A DKIM signature does not protect the whole message by default. It protects the body (through a hash) and the specific headers named in the signature's h= tag. Everything else can be changed in transit without breaking the signature. That makes the header list one of the most important and least discussed settings of a DKIM deployment: sign too little and attackers or intermediaries can alter what recipients see, sign too much and harmless changes by relays break your signatures. This guide explains how the h= tag works, which headers to include, what oversigning is and why it matters, how canonicalization affects fragility and how to audit what your platform actually signs. It builds on DKIM records, body hash failures and reading authentication results.

RequiredThe From header must always be in h=; DKIM is meaningless for DMARC without it
RecommendedSign Subject, Date, To, Cc, Message-ID, MIME-Version, Content-Type and the List headers
AvoidHeaders that intermediaries add or change, such as Received and Return-Path
HardenOversign important headers so extra copies cannot be added after signing

How h= works

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=s2025;
  t=1738490400; bh=Zm9vYmFy...=;
  h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:List-Unsubscribe;
  b=AbCdEf...

The h= value is a colon-separated list of header field names that the signature covers. The signer hashes those headers in the order listed, takes the instance closest to the bottom of the message for each name (reading from the last matching header upward) and then hashes the signature header itself with an empty b=. A verifier repeats the process. If any covered header differs, verification fails with a "header" mismatch. Headers not listed are not protected at all.

What to include

HeaderSign?Why
FromAlwaysRequired by the standard and by DMARC alignment
To, CcYesPrevents silent change of the apparent recipients
SubjectYesProtects the message text readers see first
DateYesProtects against replay with fake timestamps
Message-IDYesStable identifier; see Message-ID
Reply-ToYes, if usedAn attacker who changes Reply-To redirects replies
In-Reply-To, ReferencesYes, if presentProtect threading
MIME-Version, Content-Type, Content-Transfer-EncodingYesProtect how the body is interpreted
List-Id, List-Unsubscribe, List-Unsubscribe-PostYes for bulk mailRequired to be signed for one-click unsubscribe at several providers. See List-Id
Sender, Resent-*If presentDescribe who submitted the message
Received, Return-Path, Authentication-ResultsNeverAdded or changed by every hop and would always break
X- headers added by gatewaysNoIntermediaries add and remove them
BccNoNormally removed before sending

A good default for most senders is the list: From, To, Cc, Subject, Date, Message-ID, Reply-To, MIME-Version, Content-Type, Content-Transfer-Encoding and the List headers. Many platforms use a similar set; check yours.

Oversigning

The signature covers the instances of a header present at signing time. If you list Subject once and the message has one Subject, an attacker who later adds a second Subject header above the signed one creates a message that still verifies, because the verifier picks the bottom-most instance (the original), while many mail clients display the top-most instance (the fake). This is the header-addition attack on DKIM. Oversigning closes the gap by listing the header name one more time than it appears, so that the signature also asserts that no extra instance exists.

# The message has one From, one To and one Subject. Oversign them:
h=From:From:To:To:Subject:Subject:Date:Message-ID:MIME-Version:Content-Type

OpenDKIM, Rspamd, Exim, several cloud platforms and some commercial gateways support oversigning through a configuration option. It is a low-cost hardening step for From at the very least, and recommended for Subject, To and Date as well. Test that downstream systems do not add legitimate duplicates of those headers before enabling.

Canonicalization

ModeHeader handlingBody handlingFragility
simpleExactly as is, including case and spacingOnly trailing blank lines are ignoredVery fragile; whitespace changes break it
relaxedNames lowercased, whitespace folded and trimmedWhitespace within and at the end of lines normalisedTolerates common rewrapping; recommended

The tag c=relaxed/relaxed selects relaxed for headers and body. Almost all senders should use it; simple canonicalization causes avoidable failures when a gateway rewraps lines or normalises spacing. Also consider the l= body length tag: signing only part of the body allows text to be appended after signing, so avoid it.

Why signatures break anyway

CauseWhat changesWhat to do
Footer or disclaimer added by a gatewayThe bodySign after the gateway adds it, or move the footer into the original message. See body hash failures
Subject tag added by a mailing list ("[list]")SubjectExpected; DMARC may rely on SPF or ARC. See ARC
Link rewriting or tracking added by a security gatewayThe bodyAllowlist or accept; the first hop signature may still pass at the first checker
Line-ending or encoding conversion (for example 8-bit to quoted-printable)The body bytesUse 7-bit-safe encodings from the start
Header folding changesHeaders under simple canonicalizationUse relaxed
Signed header removed or changedThe listed headerDo not list headers that relays touch
Key rotated and DNS record removed too earlyThe key lookupKeep old selectors published. See key rotation

Auditing your configuration

  1. Send a test message from your real path to a mailbox you control and open the source.
  2. Read the DKIM-Signature header and list the names in h=. Compare with the table above.
  3. Confirm that From is present and consider oversigning it.
  4. Confirm c=relaxed/relaxed and that there is no l= tag.
  5. Check that List-Unsubscribe and List-Unsubscribe-Post are signed for bulk mail.
  6. Look at the verifying server's Authentication-Results line to see dkim=pass with the expected header.d. See reading authentication results.
  7. Send again through a forwarding address and a mailing list to see which parts survive.
  8. Document the intended header list and review it when you change platforms or add gateways.

Example: reading a signature

Suppose a signature has h=from:to:subject:date:message-id. This tells you that the sender chose not to sign Reply-To, MIME-Version, Content-Type or the List headers. A relay could therefore change the Reply-To header without breaking the signature, so replies could be redirected, and it could alter the Content-Type header, changing how the body is interpreted, though the body hash would still match the original bytes. Neither change is likely in practice, but both are exactly the kind of gap a thoughtful administrator closes. Expanding the list costs nothing as long as the headers are stable between the signer and the first verifier. Watch for headers that your own mail pipeline adds after signing, such as tracking identifiers or footers; do not include these in the signed list, and where possible move the signing step to the end of the pipeline so that it sees the message exactly as it will be transmitted.

Platform notes

Many sending platforms choose the header list for you and expose little control. In that case your job is to check, not to configure: confirm the signature covers From and the important headers, verify that the signing domain is your own (for DMARC alignment; see envelope From and header From) and ask the provider about oversigning if you have strict requirements. If you run your own signer, set the header list in one place and manage it with configuration management so every server signs the same way. When two systems sign the same message, as with a gateway that adds a second signature, both signatures can coexist; receivers evaluate each and DMARC passes if any aligned signature validates.

The header list is a small field with a large effect. Always sign From, sign the headers readers rely on, avoid those relays modify, use relaxed canonicalization and oversign where you can. Then verify with real messages, because configuration that looks right can still sign something different from what you expect.

Test your DKIM setup Check your selector, key and alignment.

Open the checker

References and further reading

Frequently asked questions

What is the h= tag in a DKIM signature?

A list of header names covered by the signature; headers not listed are not protected.

Must From be signed?

Yes. The standard requires it and DMARC alignment depends on it.

What is DKIM oversigning?

Listing a header name more times than it appears so that adding an extra copy later invalidates the signature.

Which canonicalization should I use?

Relaxed for both headers and body, because it tolerates harmless whitespace changes by relays.

Why does my signature fail after a mailing list?

The list modifies the subject or body, so the signed content no longer matches; ARC and SPF may preserve the result.

Topics#dkim#headers#canonicalization#signing#authentication
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales