Use PlainTextOutput::renderFromHtml for email subject

Created on 17 December 2019, over 5 years ago
Updated 17 February 2025, 3 months ago

In Drupal\message_notify\Plugin\Notifier\Email::deliver() we should probably use PlainTextOutput::renderFromHtml() instead of strip_tags(), as core does in https://api.drupal.org/api/drupal/core%21modules%21user%21user.module/fu....

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States KarenS

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡§πŸ‡ͺBelgium herved

    I just stumbled on this issue, in our project we use symfony_mailer_lite and print {{ subject }} in the twig mail template.
    Twig encodes these chars to HTML entities: '&<>
    If the subject contains any of these chars, then they get printed as encoded in the final twig template/email.

    This is not an issue for the actual mail subject as it goes through PlainTextOutput::renderFromHtml() here.
    But the twig template is rendered just before that, from here.
    So I believe it makes sense to apply the proposed suggestion.

  • @herved opened merge request.
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    Actually doing this would cause subject to go twice through strip_tags and html_entity_decode...

Production build 0.71.5 2024