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.