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?

2 Answers 2

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") }} 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 Source192.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! 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 ... 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. 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. Commented Dec 23, 2022 at 19:15
0

I ran into a similar issue and tried all of the above suggestion, but was unsuccessful. I ended up using {{ node.body.processed|default }} and successfully had all of the HTML rendered via the Mime Mail module, SMTP for Transport, and Mail System to glue it all together. Hope that helps someone else!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.