comment:body token arriving with HTML tags

Created on 14 August 2020, over 4 years ago
Updated 19 September 2023, over 1 year ago

Problem/Motivation

When I receive comment notify emails I'm having the problem that the [comment:body] token is being sent as HTML (e.g., with tags like this around the text:

text

). The [comment:title] is fine. I'm sending using swiftmailer, which does appear to be setup correctly to send HTML email. This is probably a simple configuration error on my behalf but I am not finding any clues about it. Can anyone point me in the right direction? I'm wanting comments to be entered with html tags,I dont want to make the field just filtered text... but maybe there's a way of putting in a filtered token??

💬 Support request
Status

RTBC

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom benjarlett

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 RandalV

    I've tested the MR and that also solves the issue for us.
    HTML mails are turned on via a contrib module, all other HTML mails / markup works.

    Thanks for the fix. Hopefully it gets committed.

  • Assigned to gnuget
  • 🇺🇸United States cedewey Denver, CO

    Thanks all for working on this fix. I'm updating this to a Bug report and assigning it to gnuget for a code review.

  • 🇳🇿New Zealand dominictaylor

    Hi All,

    I'm running into the same problem, HTML emails are fine for other system emails, but not for this module. e.g

    lorem ipsum

    I updated to version "1.x-dev@dev", but still the same issue so I assume it hasn't been reviewed and merged yet?
    Can I change the settings so Comment Notify just sends plain text or something until such time it is merged ?

    Thanks very much

  • 🇳🇿New Zealand dominictaylor

    Re: my previous comment, turns out it was due to an issue with SMTP mailer detailed here
    https://www.drupal.org/project/smtp/issues/3323386 🐛 Error sending e-mail: Invalid address RTBC

    Applying the patch from there solved it for me.

    Cheers

  • Status changed to Needs work 2 months ago
  • 🇸🇮Slovenia KlemenDEV

    This will break websites that use HTML in comment bodies of "Default mail text for sending out notifications to commenters" or "Default mail text for sending out the notifications to entity authors", which includes some of our websites.

    As it was possible to put HTML there so far, I think it is reasonable to expect this to continue to work.

  • This will break websites that use HTML in comment bodies of "Default mail text for sending out notifications to commenters" or "Default mail text for sending out the notifications to entity authors", which includes some of our websites.

    As it was possible to put HTML there so far, I think it is reasonable to expect this to continue to work.

    That's not true. I just installed the module and put in HTML tags, and they just show up as tags/text in the email. I'm using Drupal's recommended Drupal Symfony Mailer module.

  • The patches works as intended (it fixes the issue for me).

    See the related issue for supporting HTML.

  • 🇸🇮Slovenia KlemenDEV

    That's not true. I just installed the module and put in HTML tags, and they just show up as tags/text in the email.

    I use Mime Mail and it sends out HTML tags rendered. So this is true for such users. The module page only recommends the Queue Mail module, but not Drupal Symfony Mailer. It may be good to mention this in the release notes once the release is out :)

    Thanks for opening up a follow-up issue for tags support! We use HTML to add a styled button to the email to view the comment.

  • I used to use Mime Mail. It renders HTML tags even if given as plaintext HTML, I think, as it can guess the intention. However, the module's behavior ought to be consistent. The configuration isn't collecting or storing the template in a way that suggests HTML.

    Also, I do think it would be helpful for Drupal Symfony Mailer to be recommended on the module page. The module is a also drop-in replacement for Swift Mailer, which is unsupported now due to SA-CONTRIB-2024-006

Production build 0.71.5 2024