Extracted from a patch by @rivimey in the parent issue:

  1. In function mimeMailRfcHeaders, note that headers are required by the RFCs to end in CRLF - that sequence is not optional and should not be subject to a 'setting'. However inserting CR or CRLF as line ending here results in them being replaced by HTML entity in the DOM code
  2. In function mimeMailRfcHeaders, rework the wrapping code so it takes notice of the length of the key and avoids "magic numbers" like "20" and "60"; introduce named constant for max line length.

These fixes are in the patch at https://www.drupal.org/files/issues/2019-11-28/mimemail.patch

Here is a reroll of just the parts of that patch that affects mimeMailRfcHeaders(). I made a number of additional changes, especially in variable naming and comments, in order to make the code clearer.

CommentFileSizeAuthor
#3 3145542-2-mime-mail-rfc-headers.patch4.3 KBtr

Comments

TR created an issue. See original summary.

TR credited rivimey.

tr’s picture

Status: Active » Needs review
StatusFileSize
new4.3 KB

  • TR committed 1d772f9 on 8.x-1.x
    Issue #3145542 by TR, rivimey: MimeMailFormatHelper::mimeMailRfcHeaders...
tr’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.