Find & Replace Function to assist with sending HTML email that contains BBCode

Describe the problem/error/question

I am receiving the body of an email via Webhook in n8n. The body of the email contains BBCode (such that is commonly used in forums). The idea is that I use this data received and then I manipulate it and use the “Send Mail” node to send an email to various recipients.
Here comes my challenge…the “Send Mail” node can send the email as HTML, however HTML does not render BBCode correctly.
The easiest solution I could think of was doing a 'find & replace" on the body of the email and replace all the square brackets ([ b ]) with html tags (< b >), however I cannot figure out how to do a ‘find & replace’.
Any help or other suggestions would be greatly appreciated

Please share your workflow

I can unfortunately not share my workflow, as there is some sensitive information in it but here is a basic flow:
“Webhook” → “Split Objects” (Only keeping some information received in webhook) → “HTTP Get Request” (to get the email recipients email addresses) → “Send Mail”

Hi @Morne_Visagie, welcome to the community :tada:

You can use the .replaceAll() method inside n8n expressions.

So if you have a value such as Hello [b]World[/b] but want Hello <b>World</b> instead, a workflow like below:

This is the result:

Hope this helps!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.