Best practice for sending HTML email stored in Files

Hi,

I’m trying to send an email using Email: Node, and the content of that email is stored in Files. But if I pass the content of the email via template in the Email Body Template (HTML), the email recognizes it as text and not as HTML. I’ve tried some alternatives, but the only one that worked was converting the HTML to JSON (using the HTML/XML Parser block) and then using {{toHtml body}} directly in the email block. But in some cases this conversion to JSON occurs error. Would there be any other way to pass the HTML via template to the email node?

Should return as html,
image

but returns as text,
image

Here are the workflows for more details!
email-develop.flow (6.9 KB)

Thanks!

I think the solution is as simple as using triple-curly-braces in your Email Node, as Handlebars will escape HTML characters by default.

So if you’re setting the email body as {{file.result.body}}, try switching it to {{{file.result.body}}} and see if that does the trick.

Source: Introduction | Handlebars

1 Like