FIX: Errors inside your template. Template will be not saved

This is just a heads up:

If you see this error: " Errors inside your template. Template will be not saved." - you are probably dealing with a template that was previously created with the M3 GrapesJsBuilder. all you need to do is to remove the id= from the code and your email can be saved again.

Video:

https://joeykeller.com/knowledge-base-2/uncategorized/errors-inside-your-template-template-will-be-not-saved-fix/

1 Like

Hi @joeyk, thanks for the solution. I am using the Truly Personal template & getting the same error.

I tried to search for the “id” tag in the code, but nowhere to be found. Any solution?

Here is the code.

<mjml>
  <mj-body width="100%">
    <mj-raw>
      <!-- Company Header -->
      <mj-text>Hi {contactfield=firstname},
        <br>This is the personal email template.
        <br>
        <br>The purpose of this template is to look as "normal" as possible.
        <br>Many companies try to stand out with their newsletter.
        <br>This template is different.
        <br>
        <br>As a "personal brand" it makes sense to look like a regular person sending regular emails.
        <br>Use this template to do so!
        <br>
        <br>{signature}
        <br>
        <br>
        <span style="color: #838383;font-size:10px;">{unsubscribe_text}</span>
      </mj-text>
    </mj-raw>
  </mj-body>
</mjml>

Yeah, I can see that.
Try to change the second line to
**<mj-body width="600px">**
It seems, this parser cannot use % as attribute, just px.

The mj-body element accepts a width value in pixel: Documentation for MJML - The Responsive Email Framework
The default is actually: 600px

You can validate and get error messages for your template here: Email Editor

Yeah, the 3.3.3 mjml parser was more understanding with errors, it seems the M4 one simply doesnt let you save the email. Since the Truly Personal email is coming with % based setting, it will fail.

I faced this issue after installing Mautic 4. Besides the ID attribute, there were other syntax errors in the default Mautic email templates which was causing the same issue. What worked in the end was the MJML editor from here Email Editor. Its Migrate from MJML 3 button could update some syntaxes automatically like it added px unit to the ones without any unit specified. Additionally, its error identifier became helpful for issues that it couldn’t fix automatically. This gave idea about how to fix those.

I ended up writing Fix Mautic “Errors inside your template. Template will not be saved.” as a step by step guide for solving this issue.

@arafat and @joeyk thanks for your write ups and videos trying to explain this.

It’s relatively easy to do BUT it’s a super extra step that this new email editor is supposed to fix. I mean, in my opinion, Mautic’s problem for the end user has always been the editor.

Well, this is where we stand now.

Once again, thanks for the tips.

Hi, in the meanwhile this is fixed, we are waiting for code approval and will be history in 4.0.1

My fix for all templates, which have been successful so far is to :
– remove all “id” elements in tags (and reset the style associated to the id using a classname)
– Search & Replace : <br> ==> <br />

But I don’t understand :
Since Mautic 4.0.0, all <br /> tags in the template are replaced by <br>, which are NOT compatible with MJML4, causing an error (and thus the unability to close the email builder since these are not fixed in the code)

Like I said, it will be fixed in 4.0.1. I already tested the PR, works great.
Not sure what your question is. If you are trying to understand why the default templates are not working in M4 I can give you an explanation:
Noone knew, that the editor’s JS changes would break the MJML templates. When it did we started to work on the fix. This is how IT projects are.

Thanks @joeyk, in addition, I like to give a bit of explanation and technical background:

The <br> to <br /> replacement is happening from the grapesjs or mjml side. In my experience, it is not causing any problems with mjml. Also not in strict mode. But it is marked as invalid on the live editor of mjml. So I think it is save to use it.

It is the ids that are causing the error. They are not compatible with strict mode. That is why we removed it with the newest release (4.0.1).

1 Like

I also got the error and don’t know what to do. Can somebody help me?

and how can i post my code in here ?

Hi, I’m also getting the same error.

I copy-pasted a template from sendgrind though. But I dont even know what part of the code Mautic doesn’t like?