Mails resembling HTML are corrupted

Created on 4 October 2020, over 3 years ago
Updated 20 October 2023, 8 months ago

Problem/Motivation

In \Drupal\Core\Mail\Plugin\Mail\PhpMail::format() there is a conversion from HTML to text which occurs without checking if the input is an instance of MarkupInterface. This causes corruption of a mail that was in fact plain text and contains text that resembles HTML.

E.g.

Today I learnt Greek letters alphaβ they are hard to write.
In HTML, ampersand must be written as &.
I saw your house and <wow> it is great.
If a<b and b<c then a<c.

Steps to reproduce

Install a contrib module that allows sending of messages in plain text format. An example is simplenews. Type a message like the example above.

Proposed resolution

Only call htmlToText() if the input implements MarkupInterface.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

πŸ› Bug report
Status

Fixed

Version

11.0 πŸ”₯

Component
MailΒ  β†’

Last updated about 2 hours ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom AdamPS

Live updates comments and jobs are added and updated live.
  • Needs framework manager review

    It is used to alert the framework manager core committer(s) that an issue significantly impacts (or has the potential to impact) multiple subsystems or represents a significant change or addition in architecture or public APIs, and their signoff is needed (see the governance policy draft for more information). If an issue significantly impacts only one subsystem, use Needs subsystem maintainer review instead, and make sure the issue component is set to the correct subsystem.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024