Code Mode How To Display a Code snippet

Your software
My Mautic version is: 3.3.4
My PHP version is: 7.3.30
My Database type and version is: mysql 5.0.12

Your problem
My problem is:

Mautic Builder (in Code Mode) is automatically replacing:
<code>&lt;script async src=""&gt;&lt;/script&gt;</code>
<code><script async src=""></script></code>
Which I don’t want… I need to have the < and > properly displayed inside the <code></code> tags.

The question is ; “How do you display a code snippet inside an email”?
Any special syntax?
Or, how to prevent Mautic from replacing &lt; and &gt;?


I just tested in my environment and got the same behavior, even with the code mode the code get replaced. - this is definitely a bug

I tried <code>&amp;lt;p&amp;gt;this is a paragraph&amp;lt;/p&amp;gt;</code>

so, basically I replace the & with &amp; which then would make mautic replace the just the ampersand symbol, but then there was an error when sending the e-mail.

I would try to create this e-mail as template, don’t make the snippet editable, just as part of the template because I don’t think the template fixed code would be affected by mautic html parser

Hey, @leoschuler thanks for following up. If it’s a bug, should I report it somewhere else? Or tag someone? What is the next step? Thxs

I have udpated Mautic to 4.4.5 and still having the same issue.

Hi, not sure if this is the same thing you want:

       <pre style="white-space:initial">
        My evil code wont run here

sorry for the delayed response, I missed this message.

anyway, I am assuming you’re the one who open this issue: Code Mode Cannot display html code inside a code tag · Issue #11781 · mautic/mautic · GitHub

@joeyk What I’m trying to do is:

    <script async src=""></script>

This won’t work and it will break the page.

Also trying the following won’t work:

    &lt;script async src=""&gt;&lt;/script&gt;

&lt; and &gt; will be parsed and replaced by < and > breaking the code.

@leoschuler Yes!