Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300003

Mail HTML to TXT causes DKIM failure

$
0
0

DKIM fails because the mail body has been altered.

What happens:
– In the conversion of HTML to plain text (drupal_html_to_text), h3 and h4 tags are prefixed by ".... " and ".. " resp.
– SMTP uses dot-stuffing (see https://tools.ietf.org/html/rfc5321#section-4.5.2 for details) which alters the prefixes of the h3 and h4 plain text conversions.
– By altering these prefixes, the mail body has been altered and consequently DKIM verification fails.

I haven't tested it, but I expect the same issue exists in Drupal 8 with the MailFormatHelper in Drupal\Core\Mail.

In more detail:
SMTP uses a single period (dot) at the beginning of a separate line to denote the end of a mail message. Because users are not expected to be aware of this, SMTP adds an additional period (dot) before each dot on a separate line when it occurs in the message body, before sending the message.
Then DKIM signature is constructed on the mail body, including the additional period added by SMTP.
When the message is received, the receivers SMTP removes the added dots to reconstruct the original message. It thereby alters the mail body which causes the DKIM verification to fail with the error: Mail body has been altered.

The remedy for this is rather simple: use some other prefix instead of the series of dots.


Viewing all articles
Browse latest Browse all 300003

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>