Why does DKIM fail when an email has both plain text and HTML parts?

You send a message with both plain text and HTML content. The DKIM signature passes in your test environment, but fails when received. The content is identical. What went wrong?

DKIM signatures are calculated over the raw structure of an email—headers, body, and encoding. But not every mail system processes multipart messages the same way. Even small differences in line endings, encoding order, or how the boundary lines are formatted can change the canonicalized form used for signing.

When your server signs the message, it treats the text and HTML parts as a single, structured payload. The receiving server re-canonicalizes that same message using its own rules. If your signing process and their parsing don’t align—say, one uses CRLF, the other LF—validation fails, even if the final rendered content is the same.

Key takeaways

  • DKIM signature validation can fail due to differences in how multipart content is canonicalized, not because of broken content.
  • Line ending standards (CRLF vs LF) and boundary formatting must be consistent between signing and receiving servers.
  • Even identical message content can produce different DKIM signatures if the body is processed differently during canonicalization.

What is DKIM canonicalization, and why does it matter for mixed content?

DKIM signature validation fails on messages with both text and HTML parts when the email body isn’t consistently formatted during signing and checking—this is due to DKIM’s canonicalization process, which standardizes how content is processed before signing. If line endings, whitespace, or encoding differ between parts (like CRLF vs LF or quoted-printable vs UTF-8), relaxed canonicalization breaks, even if the content is functionally identical. The sender and receiver must apply the same rules to preserve signature integrity.

How DKIM's relaxed canonicalization works

DKIM uses two canonicalization methods: 'simple' and 'relaxed'. Relaxed canonicalization ignores insignificant differences—like line breaks, capitalization, and extra spaces—in both headers and body content. This makes it more forgiving of minor formatting changes during transit, which is why most senders use it.

But relaxed canonicalization relies on strict rules. For the body, it normalizes line endings to CRLF and collapses whitespace. If an email has both text and HTML parts, and those parts use different line-end styles (e.g., LF in the text part, CRLF in the HTML part), the canonicalization process sees them as different, and the signature fails.

Why mixed content breaks validation

When you send an email with both text and HTML versions, each part is often created independently and may be encoded differently. For instance, the text part might be in quoted-printable with LF line endings, while the HTML part uses UTF-8 and CRLF. If the DKIM signer processes the body using relaxed canonicalization but the validator doesn’t, or vice versa, the signature validation fails—even if the message is perfectly safe and correct.

Add in post-processing tools (like email sanitizers or ESPs that reformat content), and the risk rises. Even small changes—like adding or removing a single newline—can alter the canonicalized body and invalidate the DKIM signature.

For reliable delivery, you must ensure all content, especially in multipart emails, follows consistent formatting. Tools like MailTester’s email checker can validate address reputation and basic structural issues, though for full DKIM alignment, you’ll need to review your email generator or ESP’s handling of multipart content.

Refer to the DKIM specification in RFC 6376 for the complete canonicalization rules. The standard is precise—deviations, even small ones, will cause validation issues. This is especially critical in environments where strict authentication checks are enforced by receivers, such as major email providers or security gateways.

Common causes of DKIM failure in multipart emails

DKIM signature validation fails on messages with both text and HTML parts when the signing process doesn't match how the email is delivered — even small changes to whitespace, structure, or headers after signing break the hash. This often happens because the email client or service modifies content after signing, or because canonicalization doesn’t account for layout differences in multipart messages. Proper alignment between signing and delivery steps is critical.

Signature mismatches due to post-signing modifications

  • You’re using an email client or service that rewrites or optimizes HTML after DKIM signing — even minor changes like adding a single space or reformatting line breaks invalidate the signature.
  • Some platforms automatically compress whitespace or strip line breaks in the text part; if the signing process didn’t account for this, the canonicalized version no longer matches.
  • Let’s say you sign a message with a specific line break in the text portion — if the delivery system standardizes it across platforms (e.g., CRLF to LF), the hash will differ.

Structural issues in multipart messages

  • Mismatched MIME boundaries or incorrect Content-Type headers confuse validators, especially if boundaries aren’t properly enclosed or quoted.
  • Incorrect or missing Content-Transfer-Encoding headers (like 7bit vs. quoted-printable) can alter how the body is interpreted and break the canonicalization process.
  • Using a relay or gateway that adds custom headers or alters formatting — such as adding X-Message-ID or reordering fields — without re-signing the message breaks DKIM.
Even one extra newline in the text part, if not reflected in the signing process, can break DKIM validation. The canonicalization rules are strict — whitespace matters.

For example, the DKIM RFC specifies that whitespace normalization must be applied consistently before hashing. If your system signs with canonicalized whitespace but the delivery service introduces new line breaks without re-signing, failure is guaranteed.

Most senders miss these nuances until they hit deliverability issues. Use tools that simulate real-world delivery and validate full message structure — not just headers. For instance, the inbox placement test checks how your multipart emails are received across real inboxes, including DKIM validation steps.

How to test whether your DKIM signature holds across all email variants

You can verify DKIM signature integrity across both text and HTML email variants by sending a controlled test message with both parts, inspecting the raw header and body exactly as sent, ensuring MIME boundaries and encoding are preserved, and confirming no post-signature modifications alter content or whitespace. Use tools that simulate real delivery to multiple inboxes and expose the exact message sent.

Step-by-step validation process

  1. Send a test email with both plain text and HTML parts from your sending system. Use a tool that can deliver to multiple inboxes—ideally one that gives you access to the raw message after it leaves your server. The goal is to simulate real-world delivery conditions where both content types travel through the same pipeline.
  2. Extract the raw message headers and body exactly as sent—before any intermediary modifies it. Tools like MailTester’s inbox placement tester deliver email variants and return the full raw message, including all headers and MIME structure. This allows you to compare what was signed against what was sent.
  3. Verify the DKIM-Signature header includes the correct h= field listing the headers that were signed, such as from:to:subject:date:mime-version:content-type, and ensure these match the actual headers in the raw message. Misalignment here causes validation failure even if the content is correct.
  4. Check MIME boundary structure and encoding—ensure each part starts with a clean boundary, no mixed encodings (e.g., quoted-printable and base64 combined incorrectly), and that line endings follow CRLF. A single misformatted line or missing boundary can break DKIM validation, even if the body content is otherwise correct.
  5. Confirm no post-signature modifications occurred—such as whitespace insertion, HTML tag reformatting, or MIME reordering. These changes invalidate the signature even if the intent is benign. Services like MailTester capture the message precisely as delivered, letting you spot such alterations.
  6. Compare the original signed body against the delivered one using a diff tool. Even a single added space or line break after signing breaks DKIM. Use the MailTester email checker to validate that your sender system doesn’t inject content after signing.

Why this matters

DKIM signatures are validated by checking that the signed parts of the message match exactly what was received. If the body was altered at any stage—by a relay, a security filter, or a misconfigured MTA—the signature fails. This is commonly seen in systems that normalize whitespace, reformat HTML, or modify MIME structures. According to RFC 6376, a signature is only valid if the content and headers match exactly as signed. Testing with real variants ensures you don’t unknowingly deliver messages that appear signed but fail verification.

“Even a single character change in the signed body breaks DKIM validation.”

DKIM, SPF, and DMARC: the three layers of email authentication

You send an email, and it passes through SPF, DKIM, and DMARC checks—each validating a different part of the message’s legitimacy. SPF confirms the sending IP is authorized by the domain. DKIM ensures the message content hasn’t been altered since signing. DMARC decides the outcome if either SPF or DKIM fails, and alignment between the “from” domain and the signing domain is required. If DKIM validation fails due to issues with multipart messages—like improper handling of text and HTML parts—DMARC can still flag your domain as untrusted, even if the email itself is legitimate.

SPF: validating the envelope sender

SPF (Sender Policy Framework) checks whether the IP address sending the email is listed in the domain’s DNS record as an approved sender. It’s not about content, but about who’s allowed to send on behalf of a domain. For example, if your mail server IP isn’t in the SPF record, the message fails SPF. This doesn’t mean your email is spam, but mail filters may treat it with suspicion.

DKIM: verifying content integrity

DKIM adds a digital signature to the email header and body. The receiving server can use the public key from the sender’s DNS to verify that the message wasn’t altered in transit. This is how you confirm that a phishing email didn’t replace your offer link with a malicious one. But if your email has both text and HTML parts, and the DKIM signature isn’t applied consistently across both, the validation can fail. Even small differences in whitespace or line breaks can break the signature.

Many email providers, including Google and Microsoft, use DMARC as the enforcement layer. If SPF or DKIM fails, DMARC policies tell the recipient what to do: quarantine, tag, or accept the message. But alignment is key—your "From" domain must match the domain used in the DKIM signature. If not, even a valid DKIM signature can be ignored.

When DKIM fails due to multipart body formatting issues, DMARC reports may mark your domain as non-compliant. That means future messages could be rejected, even if they’re clean and sent from a trusted source. This is why tools that test email authenticity—like inbox placement testing—are critical for catching these edge cases before they hurt deliverability.

For a deeper technical look at how DKIM signatures are structured, see the IETF’s RFC 6376. For industry-standard guidance on alignment and policy enforcement, the DMARC.org site offers real-world implementation advice across major email providers.

Why mixed-content emails are high-risk for deliverability failure

You’re sending emails with both plain text and HTML parts, and you’re seeing DKIM signature validation failures? That’s not a coincidence. Many major inboxes—especially Gmail and Outlook—enforce strict DKIM validation that checks every part of the message. If the alignment between the sender's domain and the DKIM signature breaks in either the text or HTML part, the entire message may be flagged, deprioritized, or outright rejected, even if the rest of your setup is correct.

How strict DKIM checks impact deliverability

Even a single DKIM failure across a mixed-content email can trigger defensive filtering. Inboxes like Gmail treat DKIM validation as a hard requirement. If the signature doesn’t match the content being delivered—especially when the HTML and text portions differ in formatting, structure, or encoding—it’s seen as a sign of manipulation, not legitimacy. This is why some emails pass authentication but still land in spam. It’s not just about the signature being valid—it’s about it matching the actual message content precisely.

Let’s say your mail server generates an HTML part with a slight variation (like a wrapped

or a reordered attribute) that doesn’t align with the original DKIM-signed content. The receiving server detects that inconsistency and flags the message as suspicious. This is common in poorly configured or legacy email systems that don’t normalize content before signing. The result? Your email might still be delivered—but not to the inbox. It often lands in a spam or promotions folder, reducing engagement dramatically.

Reputation risk when failures pile up

When DKIM validation fails across multiple recipients, especially on a single send, inbox providers see that as a red flag. It suggests misconfiguration or a compromised system. High-volume senders with repeated failures—even if only a small percentage—can see their sender reputation degrade quickly. This is especially true for domain-based sender reputation models like those used by Microsoft and Google, where consistent delivery problems lead to throttling or hard bounces.

If you’re seeing failures only on mixed-content emails, the root is likely in how the message was constructed before signing. The DKIM signature must be applied to a normalized, consistent version of the message body. That’s why tools that test real message delivery—like MailTester’s inbox placement testing—can help. They simulate how your message behaves across real inboxes, including how DKIM alignment is verified.

To prevent these failures, verify your email content before sending. Use a real-time verification API to spot malformed or inconsistent message structures. For bulk senders, run inbox placement tests before sending to real users. You can test how your email is received across major providers with [MailTester’s inbox placement tester](https://mailtester.com/inbox-tester/), which checks DKIM, SPF, and content alignment under real-world conditions.

How MailTester helps detect DKIM issues before they hurt deliverability

DKIM signature validation fails on messages with both text and HTML parts when the header or body canonicalization doesn't match exactly. You can catch these issues early by testing your full message structure—including MIME parts, encoding, and canonicalization—with tools that simulate real provider behavior. MailTester checks for these exact mismatches during inbox-placement tests and via real-time API verification, so you avoid bounces and reputation damage before sending.

Testing real message structure, not just headers

DKIM requires the entire message to be processed the same way by sender and receiver. If your email has both text and HTML parts, the canonicalization process must treat the body in a consistent way—whether you’re using a standard email client or a modern inbound filter. MailTester’s inbox-placement tests send real messages through provider gateways, including Gmail, Yahoo, and Outlook, and report whether the DKIM verification passed or failed based on full message processing.

These tests analyze every part of the message: the MIME structure, encoding (like quoted-printable or base64), and how the headers and body are normalized before signing. For instance, line ending differences or extra whitespace can cause a signature to fail—even if the key is valid. This level of detail is why simply validating SPF or sender domain isn’t enough.

Real-time and bulk verification catch issues early

When you send through APIs or automation platforms, malformed DKIM headers can slip through. Let’s say your system dynamically generates messages with both text and HTML. The DKIM signature might pass in a test environment but fail in production if encoding or whitespace isn’t preserved. Our real-time API checks validate whether the address is deliverable and whether auth headers—including DKIM, SPF, and DMARC—are properly formed.

Use our email verification API to catch these issues before each send. You can also run bulk list verification to clean your database of addresses known to trigger authentication mismatches. This reduces hard bounces and improves sender reputation over time. The same system checks for issues like catch-all domains, role accounts, and disposable mailboxes—common contributors to failed DKIM validation.

To see how this applies across real inbox providers, review the results from our inbox placement tester, which checks against current filtering logic used by major email platforms. This includes post-signature validation steps that only real systems perform. As described in RFC 6376, DKIM validation is sensitive to how the message is reassembled—small changes matter. MailTester ensures your messages pass the same checks your recipients' inboxes do.

Steps to ensure your multipart messages pass DKIM validation

Daily, over 15% of emails fail DKIM validation due to subtle mismatches in MIME structure, especially when messages contain both plain text and HTML parts. The root cause? Changes made after signing, inconsistent formatting, or improper line endings. To fix this, sign your message only after final formatting, use consistent CRLF line endings, ensure your MIME structure follows RFC 2046, and test real delivery paths—not just headers. Tools like MailTester’s API can catch these issues before they reach the inbox.

Process: How to secure multipart DKIM signatures from end to end

  1. Sign after formatting is complete and before relay Never sign an email before applying final transformations like content rewriting or template flattening. The signature must cover the exact byte stream that will be sent. Modifying content after signing — even adding a space — breaks the digital fingerprint. Always place signing at the last step before handing off to the SMTP client or relay.
  2. Use consistent line endings: CRLF (Carriage Return + Line Feed) The MIME standard specifies that line breaks must be CRLF. Mixed or inconsistent line endings—especially using LF-only on Unix systems—trigger DKIM signature mismatches. Ensure your mailer or template engine outputs CRLF, not LF, regardless of platform. This is an industry-standard requirement defined in RFC 2046, the foundation of email MIME.
  3. Validate MIME structure with RFC-compliant tools Use tools that parse email structures strictly by the standard. Libraries like Python’s email module or open-source validators like RFC 2046 enforce correct syntax. Avoid manual string manipulations that can corrupt multipart boundaries. Misaligned boundaries or missing headers invalidate the entire signature.
  4. Test delivery paths, not just headers Header-only validation fails to catch issues introduced during relay or content transformation by intermediaries. Use SMTP-level simulations with real receiving servers to validate that your signed message remains intact. Testing with tools that mimic real-world routing—like MailTester’s inbox placement tests—reveals hidden problems that static checks miss.
    • DMARC adoption among top domains surged 75% between 2023 and 2025 — from 27.2% to 47.7% — in the wake of Google and Yahoo's bulk-sender authentication requirements. — EasyDMARC 2025 DMARC Adoption Report (2025)
    • After Gmail began requiring authentication for large senders, the number of unauthenticated messages Gmail users received plummeted by 75%. — Google (The Keyword blog) (2023)

Integrate real-time verification into your send workflow Don’t wait until deliveries fail. Insert MailTester’s email verification API into your outbound pipeline. It checks for both syntax and delivery risks, including malformed DKIM signatures in multipart messages. Catching issues early means fewer bounces, better sender reputation, and higher inbox placement. With 100 free verifications to start, there’s no risk in testing the integration now.

DKIM signature validation fails on messages with both text and HTML parts when malformed or invalid addresses receive emails they can’t properly process—especially if they use catch-all systems, role accounts, or disposable domains. These addresses often lack proper inbound handling or retry logic, causing signature mismatches during delivery. Using MailTester to verify email lists before sending removes these error-prone recipients, reducing the chance of authentication failures due to routing or parsing issues.

Invalid addresses strain authentication systems

When you send to a malformed or non-existent address, the receiving server may still accept the message but fails to validate the DKIM signature during processing—especially if it handles multipart content poorly. This is common with catch-all or role-based inboxes (like admin@ or sales@) that accept all incoming mail but can’t parse the message body correctly. The result? A DKIM failure not because of your domain’s configuration, but because the receiving system isn’t equipped to handle the content format.Even a single misformatted message can trigger alerts in sender reputation systems, especially if it's the first of many sent to a failing address. This adds to your spam score over time, reducing your chances of delivery even when DKIM is technically valid. By filtering out problematic emails beforehand, you stop the chain of failures before they begin.

Prevention starts with verification

MailTester catches these issues during bulk verification by checking against real-time data: it detects disposable domains, role addresses, non-existent inboxes, and catch-all systems. When you send only to verified addresses—those that respond to DNS checks and SMTP interactions—you reduce the risk of sending to systems that mishandle multipart content or drop DKIM validation due to internal routing quirks.For example, a well-configured mail server will validate both the text and HTML parts of a message and verify DKIM signatures accordingly. But many poorly maintained servers or temporary inboxes can’t process the full message. By preventing sends to those endpoints, you improve delivery consistency and keep reputation signals clean. A cleaner send list means fewer false negatives in DKIM validation, which helps ensure that legitimate failures—those due to actual technical issues—get treated as such, not as signs of abuse.Data from RFC 6376 confirms that DKIM validation relies on consistent message parsing across the entire delivery chain. When the receiving server cannot reconstruct the original message from the parts, the signature fails—even if it was correctly signed. Verifying your list ensures you don’t send to endpoints that break this chain.Start with a clean list. Use MailTester’s bulk verification tool to eliminate risk before sending. It checks for invalid, disposable, catch-all, and role addresses in real time—keeping your sending reputation strong and your DKIM alignment intact.

In summary: preventing DKIM failures in multipart emails

DKIM signature validation fails on messages with both text and HTML parts when the message body is altered after signing, such as through reformatting, re-encoding, or inconsistent canonicalization. The signed content must match the delivered content exactly.Even small differences—like line ending changes, extra whitespace, or different character encodings—can invalidate a DKIM signature. This makes it essential to use tools that test DKIM integrity in real-world conditions, not just in isolation.MailTester lets you simulate actual delivery across major inbox providers, verifying that your multipart emails maintain DKIM integrity. Combined with consistent list hygiene and bulk email verification, it helps ensure reliable deliverability at scale.

Sources

Keep reading

Ready to put this into practice? MailTester verifies emails with 98.9% accuracy — start with 100 free verifications.

Frequently asked questions

Can DKIM fail even if the email is not modified?

Yes—DKIM can fail due to differences in how the sending and receiving systems canonicalize the message, especially in multipart emails with text and HTML parts.

What happens if DKIM validation fails for a sent email?

The receiving server may reject the message, flag it as spam, or treat it as unauthorized, which impacts inbox placement and sender reputation.

Does using both text and HTML in an email increase DKIM risk?

Yes—adding multiple parts increases complexity in canonicalization and encoding, making it easier for small inconsistencies to break the signature.

How can I check if my DKIM signature is valid with mixed content?

Use a real-time email deliverability tester that analyzes both the raw message and authentication results across major inbox providers.

Do all email providers enforce DKIM validation the same way?

No—some providers allow minor DKIM failures, while others reject messages with any signature issue, especially with complex multipart content.

Yes—cleaning your list to remove catch-all, role, and disposable addresses reduces exposure to systems that may mishandle multipart emails.

Is it safe to modify an email after DKIM signing?

No—any change to the body or headers after signing invalidates the signature. Always sign last, before delivery.

How can I test DKIM behavior before sending to a large list?

Use MailTester’s inbox-placement testing to send real messages through multiple providers and verify SPF, DKIM, and DMARC results.

What is the impact of DKIM failure on sender reputation?

Repeated DKIM failures may be flagged by inbox providers as signs of poor sending practices, which can lead to throttling or blocking.

Does MailTester check DKIM signature validity?

Yes—its deliverability tests verify DKIM results as part of full inbox placement evaluation on major providers.

How accurate is MailTester's verification process?

MailTester achieves 98.9% accuracy in verifying email addresses and detecting deliverability risks, including authentication issues.

Can I use MailTester's API to check email addresses before sending?

Yes—the real-time API allows you to validate individual addresses and detect issues like catch-all, role, or invalid domains before sending.