Why is Microsoft DKIM failing when Gmail passes, and how to fix it?

Summary

Microsoft's DKIM failures, despite Gmail passing, stem from a complex interplay of factors. These include Microsoft's stricter validation processes, potential text encoding and folding issues, and internal email forwarding that can alter message content and break DKIM signatures. The signing of DKIM by third-party providers like Postmark also shifts some responsibility for DKIM configuration to them. Furthermore, outdated algorithms (SHA-1), DKIM misconfigurations (incorrect selectors, DNS propagation issues), whitespace/line ending discrepancies, and incorrect canonicalization methods contribute to the problem. Using shared IPs or non-alignment of DKIM domain with the 'From' header can also lead to failures. Solutions involve verifying DNS records, using DKIM validation tools, upgrading algorithms, checking key lengths, examining authentication headers, and ensuring proper selector and canonicalization configurations.

Key findings

  • Stricter Validation: Microsoft may have stricter DKIM validation than Gmail.
  • Encoding/Folding: Text encoding and folding issues can cause Microsoft failures.
  • 3rd Party Signing: Email providers like Postmark handle DKIM, making them responsible for configuration issues.
  • Internal Forwarding: Microsoft's internal forwarding alters message content, breaking DKIM signatures.
  • Outdated Algorithms: The use of SHA-1 might not be supported by Microsoft; SHA-256 is preferred.
  • DNS Misconfiguration: Incorrect DNS settings, typos, and propagation problems contribute to DKIM failures.
  • Incorrect Selector: An incorrect DKIM selector in the DNS record can lead to validation failures.
  • Whitespace/Line Endings: Improper handling of whitespace and line endings causes DKIM issues.
  • Canonicalization: Differing canonicalization methods between sender and receiver cause DKIM to fail.
  • Key Length: Microsoft requires a minimum DKIM key length (e.g., 1024 bits).
  • Alignment: DKIM signing domain not matching the From: domain results in DMARC failures and possibly DKIM failure at Microsoft.

Key considerations

  • Encoding Checks: Examine text encoding and folding to prevent DKIM failures.
  • Provider Support: If your provider handles DKIM signing, contact them to resolve issues.
  • Analyze Forwarding: Inspect DKIM before and after Microsoft's forwarding.
  • Algorithm Upgrade: Switch to SHA-256 for better security and compatibility.
  • DNS Verification: Verify DNS record validity using online tools and ensure correct syntax.
  • Selector Configuration: Correct the selector with your provider/sending server.
  • Header Examination: Review Authentication-Results headers provided by Microsoft for error details.
  • Consistent Methods: Ensure canonicalization methods match at sender and receiver.
  • Key Length: Ensure your key length meets Microsoft's minimum requirements.
  • Alignment: Ensure that the DKIM signing domain is aligned with the 'From' header.

What email marketers say
10Marketer opinions

Microsoft may fail DKIM checks when Gmail passes due to stricter validation, DKIM misconfigurations or changes during forwarding, or outdated encryption algorithms. Potential solutions include ensuring correct DNS configuration, validating the DKIM record and signature, checking the key length and selector, analyzing the authentication results header, using a dedicated IP, and upgrading to a more secure algorithm like SHA-256.

Key opinions

  • Stricter Validation: Microsoft's DKIM validation might be more stringent than Gmail's.
  • DKIM Misconfiguration: Incorrect DNS configuration, typos in the DKIM TXT record, or incomplete DNS propagation can cause failures.
  • Message Alteration: Microsoft forwards emails internally and may modify the message, breaking DKIM.
  • Outdated Algorithms: Microsoft may have deprecated support for the SHA-1 algorithm, recommending SHA-256 instead.
  • Key Length: Microsoft may require a minimum DKIM key length (e.g., 1024 bits).

Key considerations

  • DNS Configuration: Ensure the DKIM TXT record is correctly published and has fully propagated. Check for typos.
  • DKIM Validation: Validate the DKIM signature using tools like DKIMValidator or MXToolbox's DKIM record lookup tool.
  • Key Length Upgrade: If the DKIM key is shorter than 1024 bits, upgrade it.
  • Authentication Results: Carefully examine the authentication-results header provided by Microsoft for specific diagnostic information.
  • Selector Check: Double-check the DKIM selector in the DNS record and ensure it matches the signing process.
  • Dedicated IP: Consider using a dedicated IP address to control your sending reputation, especially if on shared IPs.
  • SHA-256 Algorithm: Ask your email service provider to upgrade to a more secure algorithm like SHA-256.
Marketer view

Email marketer from Mailhardener explains a common reason for deliverability problems are due to shared IP addresses which can cause deliverability issues so dedicated IP addresses are a good fix if you have deliverability issues and want control over your sending reputation. URL: https://www.mailhardener.com/blog/shared-vs-dedicated-ip-addresses

April 2023 - Mailhardener
Marketer view

Email marketer from Reddit shares that sometimes Microsoft's servers are very sensitive to the slightest DKIM misconfiguration. They recommend double-checking the selector used in the DKIM record and ensuring it matches the one used in the signing process. URL: https://www.reddit.com/r/emailmarketing/comments/xyz123/dkim_failing_on_microsoft_but_passing_on_gmail/

July 2024 - Reddit
Marketer view

Email marketer from EasyDMARC recommends using online tools to check the DKIM record to confirm it's valid and propagates correctly. Tools like EasyDMARC's DKIM Record Lookup can identify issues such as typos, incorrect syntax, or propagation problems. URL: https://easydmarc.com/tools/dkim-record-lookup/

November 2023 - EasyDMARC
Marketer view

Email marketer from MXToolbox explains that using their DKIM record lookup tool, you can diagnose if the correct public key is available in DNS and validates against messages being sent. A mismatch here would lead to Microsoft rejecting the DKIM signature, even if Gmail accepts it. URL: https://mxtoolbox.com/dkim.aspx

June 2021 - MXToolbox
Marketer view

Marketer from Email Geeks notes the DKIM hashing algorithm is sha-1, an old, insecure, deprecated algorithm, and suggests asking Postmark to use sha-256.

July 2023 - Email Geeks
Marketer view

Marketer from Email Geeks suggests Microsoft might have deprecated support for sha-1 and recommends talking to Postmark.

April 2022 - Email Geeks
Marketer view

Email marketer from Email on Acid shares that issues may arise due to incorrect DNS configuration. To fix this, check that the DKIM TXT record is published correctly, that there are no typos, and that the DNS record has fully propagated. DNS record lookup tools are useful for this. URL: https://www.emailonacid.com/blog/article/email-authentication-spf-dkim-dmarc/

March 2022 - Email on Acid
Marketer view

Email marketer from Email Marketing Tips suggests to check the DKIM key length as Microsoft and some other providers now require a minimum key length (e.g., 1024 bits). If your DKIM key is shorter, upgrade the key length to prevent failures. URL: https://www.emailmarketingtips.com/troubleshooting-dkim-failures/

January 2022 - Email Marketing Tips
Marketer view

Email marketer from Super User explains to look carefully at the authentication-results header that Microsoft is providing. It may offer specific diagnostic information about why the DKIM check failed. Often this is more informative than a simple pass/fail result. https://superuser.com/questions/480137/dkim-spf-check-failed

June 2024 - Super User
Marketer view

Email marketer from Stack Overflow explains that Outlook might be more strict with DKIM validation than Gmail. They suggest ensuring the DKIM record is published correctly, the signing is valid by using tools like DKIMValidator, and that the body hash is calculated correctly, particularly with line endings. URL: https://stackoverflow.com/questions/26004445/dkim-works-for-gmail-but-not-outlook

October 2024 - Stack Overflow

What the experts say
5Expert opinions

Microsoft DKIM failures, while Gmail passes, stem from various sources. Text encoding/folding issues or how Microsoft computes hashes can lead to failures. Because the sending provider (e.g., Postmark) often signs DKIM, the user might need to escalate issues to them. Also, Microsoft’s internal forwarding can break DKIM signatures if the email content is changed in transit. Upgrading the encryption algorithm from SHA-1 is suggested, but Microsoft might simply be breaking things themselves. Authentication results headers contain diagnostic information useful for pinpointing the cause.

Key opinions

  • Text Encoding/Folding: Microsoft failures can come from text encoding or folding issues during DKIM validation.
  • Third-Party Signing: The email provider (e.g., Postmark) typically signs DKIM, shifting responsibility for DKIM issues to them.
  • Internal Forwarding: Microsoft's internal forwarding can alter email content and break DKIM signatures.
  • Algorithm Incompatibilities: The encryption algorithm, like SHA-1, could be the source of the issue, even though custom SPF records allow DMARC to pass. Consider if MSFT even supports it.
  • Microsoft Peculiarities: Microsoft may have unique ways of computing hashes that cause DKIM signatures to fail, even when they are valid elsewhere.

Key considerations

  • Text Encoding Checks: Examine text encoding and folding configurations to prevent Microsoft DKIM failures.
  • Escalate to Provider: If the sending provider signs DKIM, reach out to them for DKIM issues.
  • Analyze Forwarding: Inspect DKIM signatures before and after Microsoft's internal forwarding to diagnose breakages.
  • Upgrade Algorithm: Switch from SHA-1 to a more current encryption algorithm as a possible fix.
  • Examine Headers: Use the authentication results header to find the exact cause of the DKIM failure in Microsoft.
Expert view

Expert from Email Geeks explains that Postmark is signing with DKIM, not the user, and the domain being evaluated by Outlook for DKIM is ab.mtasv.net which is Postmark's domain, so the user needs to escalate to Postmark.

January 2025 - Email Geeks
Expert view

Expert from Email Geeks explains that sha-1 is the encryption algorithm used to generate the hash for signing and that DMARC is passing because of the custom SPF domain, and it may not be sha-1, Microsoft could just be breaking something.

December 2022 - Email Geeks
Expert view

Expert from Word to the Wise explains Microsoft often forwards messages internally, and this can break DKIM signatures if the message content is altered during the forwarding process. Verifying the DKIM signature before and after forwarding can help identify if this is the issue. They also advise checking the authentication results header to pinpoint the exact reason for the failure. URL: https://wordtothewise.com/2015/01/dmarc-failures-internal-forwarding/

June 2022 - Word to the Wise
Expert view

Expert from Email Geeks explains when one provider like Microsoft is failing DKIM, it’s often a text-encoding or folding issue and asks if relaxed/relaxed is being used, and what encryption type.

February 2023 - Email Geeks
Expert view

Expert from Email Geeks states Microsoft does a lot of internal forwarding and breaking DKIM happens, suggesting that Postmark stop using sha1 and use a current algorithm could help with the breakage.

March 2024 - Email Geeks

What the documentation says
5Technical articles

Microsoft DKIM failures, in contrast to Gmail's passing, can be attributed to several technical factors detailed in various documentation sources. Message modification during transit, often due to forwarding or list servers, invalidates the signature. The DKIM specification emphasizes precise handling of whitespace and line endings, and discrepancies can cause validation failures. DKIM alignment, where the signing domain must match the 'From' header domain, is vital for DMARC compliance, which Microsoft may enforce more strictly. Also, an incorrectly configured DKIM selector is a common cause of DKIM failures. Different canonicalization methods for headers and body can break DKIM even if both sender and receiver adhere to standards.

Key findings

  • Message Tampering: Message modification during transit invalidates DKIM signatures.
  • Whitespace/Line Endings: Inconsistent handling of whitespace and line endings causes DKIM failures.
  • DKIM Alignment: Mismatched DKIM-signing domain and 'From' header domain causes DMARC failure.
  • Incorrect Selector: An incorrect DKIM selector results in DKIM failures.
  • Canonicalization Mismatch: Differing canonicalization methods between sender and receiver break DKIM.

Key considerations

  • Inspect Message Headers: Check message headers for indications of tampering during transit.
  • Ensure Correct Handling: Ensure proper handling of whitespace and line endings during signature generation.
  • Verify Domain Alignment: Verify that the DKIM-signing domain aligns with the domain in the 'From' header.
  • Correct Selector Configuration: Check the DKIM selector with your provider or sending server and ensure it is correct.
  • Consistent Methods: Ensure canonicalization methods for headers and the body match between sender and receiver.
Technical article

Documentation from Microsoft Learn explains that DKIM failures can occur if the message is modified in transit, invalidating the signature. This could be due to email forwarding or list servers that alter the message content. They recommend checking the message headers for any indication of tampering. URL: https://learn.microsoft.com/en-us/Exchange/mail-flow-best-practices/email-authentication

June 2024 - Microsoft Learn
Technical article

Documentation from AuthSMTP explains that an incorrect selector is one of the common reasons for DKIM failing, check your selector is set correctly with your provider or sending server. URL: https://www.authsmtp.com/dkim/

June 2021 - AuthSMTP
Technical article

Documentation from RFC Editor explains that the DKIM specification (RFC 6376) requires proper handling of whitespace and line endings during signature generation. Discrepancies in how different mail servers handle these aspects can lead to validation failures. URL: https://www.rfc-editor.org/rfc/rfc6376

June 2024 - RFC Editor
Technical article

Documentation from DMARC.org explains that DKIM alignment is crucial for DMARC compliance. If the DKIM-signing domain doesn't match the domain in the 'From' header, DMARC may fail even if DKIM passes. This could be why Gmail passes (which may not be enforcing DMARC as strictly), but Microsoft fails. URL: https://dmarc.org/overview/

March 2023 - DMARC.org
Technical article

Documentation from OpenDKIM explains that the DKIM specification allows for different canonicalization methods for headers and the body. Using different canonicalization methods in senders and receivers will break DKIM even though both parties are standards compliant. https://www.opendkim.org/

June 2023 - OpenDKIM