Skip to content

Mail line length too long, breaks DKIM signature #24528

@delgor

Description

@delgor

E-Mails sent by Magento are generated with too long lines for HTML content, which leads to further problems during processing by an DKIM-enabled E-Mail stack.
The maximum line length for a mail is defined in http://www.rfc-editor.org/rfc/rfc5322.txt

2.1.1. Line Length Limits

There are two limits that this specification places on the number of
characters in a line. Each line of characters MUST be no more than
998 characters, and SHOULD be no more than 78 characters, excluding
the CRLF.

The 998 character limit is due to limitations in many implementations
that send, receive, or store IMF messages which simply cannot handle
more than 998 characters on a line. Receiving implementations would
do well to handle an arbitrarily large number of characters in a line
for robustness sake. However, there are so many implementations that
(in compliance with the transport requirements of [RFC5321]) do not
accept messages containing more than 1000 characters including the CR
and LF per line, it is important for implementations not to create
such messages.

Preconditions (*)

  1. Magento CE 2.3.2
  2. A DKIM-enabled E-Mail setup. I've used sendmail-mta together with opendkim. Setup instructions can be found at http://www.opendkim.org/opendkim-README

Steps to reproduce (*)

  1. Send any E-Mail through Magento.
    For testing I've used the newsletter registration and sent the mails towards mail-tester.com. But any mail-sending functionality (customer registration, forgotten password have been tested) gain the same results.

Expected result (*)

The recipient shall receive an valid, DKIM-signed e-mail. Please see the attached screenshot "screenshot-mail-tester-valid-signature.png". Relevant are the DKIM_VALID recognition by SpamAssassin and the line "Your DKIM signature is valid".
screenshot-mail-tester-valid-signature

Actual result (*)

The message body gets repaired during transit due to the original line length violation, leading to an invalid DKIM signature (body hash mismatch) - just as if the message had been modified on its way.
Please see the attached screenshot "screenshot-mail-tester-invalid-signature.png"
screenshot-mail-tester-invalid-signature

Metadata

Metadata

Assignees

Labels

Issue: Format is validGate 1 Passed. Automatic verification of issue format passed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions