1

I use Drupal 9 and the Rules module to send emails when an Article node is updated.
I installed the Mimemail module and set the formatter to mimemail; all the field are correctly rendered. Only {{ node.body.value }} displays the HTML markup in the mail directly.

The rule settings are the following.

Hello, {{node.field_unit}} !<br>
New Message Alert!<br>
<br>
id:{{ node.field_id }}<br>
mail:{{ node.field_mail }}<br>
type:{{ node.field_type }}<br>
time:{{ node.created }}<br>
subject:{{ node.title }}<br>
content:<br>
{{ node.body.value }}<br>

The received email is rendered like in this screenshot.

the email result

These are the value stored in the database.

In the database

I'm not sure how to solve this.

Could anyone help me?

1 Answer 1

0

Instead of .value use .processed to get the formatted output:

{{ node.body.processed }}
5
  • In some circumstances you might have to use a filter to prevent Rules from sanitizing the output: {{ node.body.processed | format_text("full_html") }}
    – anonymous
    Commented Jul 6, 2022 at 23:01
  • Hello, I try {{ node.body.processed }}, the tags will show in the mail. And I try {{ node.body.processed | format_text("full_html") }} it will show an error in logs --->Missing text format: "full_html". Type filter Date 2022 7 4 - 11:52 User admin Location 192.168.7.173/node/148/edit?destination=%2Ffeedback Source 192.168.7.173/node/148/edit?destination=/feedback Message Missing text format: "full_html". But I do enable the full_html format Do you have any idea how may this occur? Thanks!
    – Webster H.
    Commented Jul 7, 2022 at 4:00
  • Go to /admin/config/content/formats/manage/full_html - this should exist if you have a filter with the machine name "full_html". If it DOES exist then I don't know why you're getting that error. That error will be generated by the core filter module when a filter plugin with the machine name "full_html" can't be found. It wouldn't hurt to clear your cache ...
    – anonymous
    Commented Jul 7, 2022 at 4:37
  • yes I do have the format machine name as full_html... I don't know why either. Anyway thanks for your reply. I'm using business rules instead.
    – Webster H.
    Commented Jul 9, 2022 at 6:47
  • I'm not sure why, but this solution works for me only when I use single quotation marks around full_html: {{ node.body.processed | format_text('full_html') }}. Just mentioning this in case it will help someone else.
    – sjhuskey
    Commented Dec 23, 2022 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.