Adding JavaScript to Email-Builder

Hey everyone,

I’m facing an issue while attempting to add JavaScript to my email template within Mautic’s builder. When I include JavaScript code, the entire template breaks, and I can only see the output of the script without any other content:
image
I’ve tried various slot types, but the result remains the same. The problem is resolved when I edit the template in code mode:
image

I’m currently still using Mautic version 3.3.3. Is this a known issue, and has it been addressed in later versions? Or am I missing something in the process?

Thank you for your help.

What do you want to achieve?

Emails don’t support javascript.

You might want to look at GitHub - content-optimizer-gmbh/mautic-advanced-templates-bundle: Plugin extends default email template capabilities with TWIG block so you can use advanced scripting techniques like conditions, loops etc if you want to have something dynamic.

1 Like

Ah, I didn’t know that. But the plugin would pretty much solve my issue. I will have a look at it.

Very much appreciated.