#17575·mautic

MJML email builder Save silently no-ops when content contains an HTML entity inside an inline style (mjmlToHtml swallows the error; builder stays open, nothing saved, no error shown)

Author: JustinKeltnerCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugneeds-triage

Mautic Series

7.2.x series

Mautic installed version

7.2.1

Way of installing

I installed with composer using https://github.com/mautic/recommended-project

PHP version

8.3.33

What browsers are you seeing the problem on?

Chrome

What happened?

In Mautic 7.2.1 (also 7.2.0), if an mj-text component contains the literal HTML entity &amp;quot; inside an inline style value — e.g. quoted font names produced when markup is copied from rendered/escaped HTML — the builder cannot save. Clicking Close (or Save) appears to do nothing: no error, no request, the builder stays open, the email keeps its old content. Silent data loss. Minimal trigger: <p style="font-family:&amp;quot;Segoe UI&amp;quot;, Arial, sans-serif;">x</p> Cause: mjml2html post-processing throws "TypeError: Cannot read properties of undefined (reading 'indexOf')". MjmlService.mjmlToHtml catches it and returns "", so closeEditorEmailMjml throws Error("Could not generate html from MJML") BEFORE ButtonCloseCommands.returnContentToTextarea()/resetHtml() — the hidden customHtml/customMjml textareas are never written and the error is uncaught. The intended user-facing alert in getEditorHtmlContent() is unreachable because mjmlToHtml swallowed the error first. Scope: ordinary pastes from Word/Google Docs/websites are NOT affected (their quotes are real " characters, not the &amp;quot; entity). Only entity-encoded quotes inside a style value reproduce this. Workaround: paste as plain text, paste into the MJML source view, or replace &amp;quot; with " before saving. Related (not duplicates): #17374 (HTML-escaped CSS in ), #17276 (same Apply/Close MJML path and same throw), #17288, #17030. Suggested fix: (1) decode HTML entities in attribute/style values before mjml2html; (2) do not swallow the error — let getEditorHtmlContent surface it; (3) never throw before persisting — write what was generated and close the builder.

How can we reproduce this issue?

  1. Open any email in the GrapesJS MJML builder.
  2. Double-click a text component to enter the RTE.
  3. Paste: <p style="font-family:&amp;quot;Segoe UI&amp;quot;, Arial, sans-serif;">x</p>
  4. Click outside the text component, then click the builder Close (✕) — or Save.
  5. Observed: nothing happens, no dialog, builder stays open, email not saved. Console: uncaught "Error: Could not generate html from MJML" at closeEditorEmailMjml, plus a swallowed "TypeError: Cannot read properties of undefined (reading 'indexOf')".
  6. Control: the same paragraph with real quotes instead of &amp;quot; saves normally.

Relevant log output

bash
Error: Could not generate html from MJML
    at r.closeEditorEmailMjml (plugins/GrapesJsBuilderBundle/Assets/library/js/dist/builder.js)
TypeError: Cannot read properties of undefined (reading 'indexOf')
    at plugins/GrapesJsBuilderBundle/Assets/library/js/dist/builder.js (Array.filter)
// after the throw: builder stays open; textarea.builder-html/.builder-mjml not updated;
// emails.custom_html / custom_mjml unchanged; no POST to /s/emails/edit/<id>; no alert shown

Code of Conduct

  • I confirm that I have read and agree to follow this project's Code of Conduct



Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.