Problem description

In some cases this module should convert HTML content to text but it doesn't.

Steps to reproduce:

  1. Configure settings so that messages will be sent as Plain Text. Either a) enable respect_format or b) disable it and set output format to Plain Text.
  2. Send a mail that is capable of generating markup. For example use the default contact form.
  3. In the message include some special character - I used A & B <c

Expected: Message appears as typed
Actual: Message appears as HTML A &amp; B <c></c>

Proposed resolution

Drupal Core has the required code in PhpMail::format(). We need to call MailFormatHelper::htmlToText() if the output format is text/html and the input is markup. This code should go in SwiftMailer::massageMessageBody().

CommentFileSizeAuthor
#2 swiftmailer.htmlToText.3123159-2.patch727 bytesadamps

Comments

AdamPS created an issue. See original summary.

adamps’s picture

Status: Active » Needs review
StatusFileSize
new727 bytes

Status: Needs review » Needs work

The last submitted patch, 2: swiftmailer.htmlToText.3123159-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

adamps’s picture

Title: Incorrect logic for converting htmlToText » If output is text/plain must call htmlToText conversion
Issue summary: View changes
Status: Needs work » Postponed
adamps’s picture

Status: Postponed » Fixed

Was fixed as part of #3122389

Status: Fixed » Closed (fixed)

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