Email builder not working on v4.1

Your software
My Mautic version is: 4.1.0
My PHP version is: 7.4
My Database type and version is:
MariaDB 10.2

Your problem
My problem is: When I open the email builder, nothing works. The code editor is not displayed, the close button does not work, etc.

JAVASCRIPT ERROR

2:4 Uncaught Error: No valid HTML template found
at Function.getOriginalContentHtml (content.service.js:119)
at l.value (builder.service.js:204)
at l.value (builder.service.js:107)
at Object.s [as launchBuilder] (builder.js:33)
at HTMLButtonElement.onclick (2:1601)
at Object.trigger (libraries.js?v35708ed5:683)
at HTMLButtonElement. (libraries.js?v35708ed5:688)
at Function.each (libraries.js?v35708ed5:153)
at jQuery.fn.init.each (libraries.js?v35708ed5:144)
at jQuery.fn.init.trigger (libraries.js?v35708ed5:688)

These errors are showing in the log: none

Steps I have tried to fix the problem: clear:cache

Did u upgrade from 3+? Make sure your templated have the right format in the config files. The editor value must be an array. Check template config file structure in the docs.

The config.json should look like this:


{
  "name": "Great Theme",
  "author": "Mr. Robot",
  "authorUrl": "https://mautic.org",
  "builder": "[grapesjsbuilder]",
  "features": [
    "email"
  ]
}

Mind the line with the editor. It has to be an array using [. ]

It is a fresh installation.

Have a look to the loom video. Loom | Free Screen & Video Recording Software

I am actually trying to create an email “template” and paste an html.

Any suggestion?

Hi,
Can you plz check if by plugins grapesjs is enbled?

Hi,

How to check if it is enabled?

And if it is not, how to enable it?

Thanks

My issue is when I try to open a CODE MODE but code editor isn’t loaded properly

Go to plugins and check if the grapesjs is enabled. Click the gear icon > plugins

Yes, it is enabled.
What else I can check to start being able to use the CODE MODE?

I also did

php bin/console mautic:plugins:update
php bin/console cache:clear
php bin/console mautic:assets:generate

Still not working

Is this an email you already saved? If so…
Can you check what the first line of the code is in this email’s custom_html column in the email table?

Yeap! I have just created the email and saved it.
The custom_html field in the emails table is empty (not null)

I am not being able to edit it since the editor does not open properly (javascript message I’ve sent in the previous email)

Weird.

Add this and plz check if it opens afterwards:

<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>

<body>
The content of the document......
</body>

</html>

With the snippet you suggested, the CODE MODE works properly. I am able to open the editor and make modifications.
I first had to add it manually to the custom_html field in the emails table

Okay, at least we know what the problem is in your install. When you open code mode the html is not properly created… try any other template and overwrite the code.

Thank you!

I had the same problem on a clean Mautic 4.1.1 install ( PHP Version 7.4.27, MariaDB 10.6.5) and tried various solutions, including a fresh reinstall.

What finally solved it, and it is extremely strange, is when I reinstalled it with a prefix in my database tables. I know how it sounds, but would it make any sense at all?

I did another fresh install with same setup (docker, PHP Version 7.4.27, MariaDB 10.6.5) with no table prefix, same theme for GrapesJS, and it worked fine.

So I have no idea what causes the problem, but it does happen intermittently.

What worked for me was to set file/directory permissions again (as suggested in the install instructions). Seems it has to be done frequently…

This is true for all Mautic.
Usually happens if you run your cronjobs with the wrong user. Make sure it’s the same as the web server user. Most of the time it’s www.

Just a thought, might be another issue. Good luck.

email template save and apply button not show : solve the problem: