# Not sending emails - adding various CSS to mails - sending email create 503 error

**URL:** <https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651>\
**Category:** Product Support\
**Created:** [July 4, 2024, 2:12pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651 "2024-07-04T14:12:52Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 4, 2024, 2:12pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/1 "2024-07-04T14:12:52Z")

</div>

**Your software**  
My Mautic version is: 5.1  
My PHP version is: 8.1.29  
My Database type and version is: 10.6.18-MariaDB

**Your problem**  
My problem is:

I created a custom mautic email theme that worked perfectly in Mautic 4, allowing me to send and edit this emails without any issues. However, after upgrading to Mautic 5, I encountered a problem where the emails would stop sending without any apparent reason after editing or saving the theme three or more times.

Here are some details:

1. Sending the (not edited) theme directly to a segment works fine initially, with emails sent in batches of 100 to 149 users.  
[Imgur: The magic of the Internet](https://imgur.com/WXYRIfL)  
[Imgur: The magic of the Internet](https://imgur.com/MKcdFWX)

2. Opening, editing and saving the theme once works without issues. I can still use the “auto-generate” function for the text version of the email and send it without problems.  
[Imgur: The magic of the Internet](https://imgur.com/UBlA3Dd)

3. However, if I open and save the theme three or more times, the email stops sending. Additionally mautic creates a 503 error on sending.  
After update from 5.0 to mautic 5.1 the 503 is gone but still, the text version generation fails. If I attempt to send it anyway, the process halts at around 40 emails without any error message, indefinitely.

4. When I return to the email tab, it doesn’t show that the emails were sent in the overview. Clicking on the email shows that some emails were indeed sent, but continuing the sending process only sends about 40 more emails each time without updating the overview. If I repeat this step multiple times, eventually all emails are sent, though they still don’t appear in the overview.  
The statistics are not usable and wrong.

Overview: [Imgur: The magic of the Internet](https://imgur.com/F1vMgwW)  
Statistics: [Imgur: The magic of the Internet](https://imgur.com/NmeBt3t)

1. Inspecting the email’s source code reveals that Mautic adds strange CSS code (presumably each time I save the template), which may be increasing the email size until it becomes too large to send.

my theme: [https://mautic.vaegabond.com/email/preview/154](https://mautic.vaegabond.com/email/preview/154)  
Theme Only code (without saving) after sent to user: [--gjSlLf87Content-Type: text/plain; charset=utf-8Content-Transfer-Encoding: - Pastebin.com](https://pastebin.com/tKnmLVQV)  
Theme code (3 or more times saving) after sent to user: [gist:aba304e4c560a60352f9c98273a009aa · GitHub](https://gist.github.com/cremigerhonig/aba304e4c560a60352f9c98273a009aa)

1. Another issue I’ve noticed is that when I open the theme in the Mautic builder (not GrapesJS), I can’t edit the template right away; I have to save it once before editing becomes possible. I’m unsure why this behavior occurs.

**None of these issues were present in Mautic 4, where the same theme functioned perfectly.**

**Settings in Mautic:**  
Queue for email set to doctrine  
[![Imgur](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/c870eb5eee11717791ee4fd6997f162a01aaa805.png "imgur.com") ](https://imgur.com/R9I3MyQ)  
before it was also set to sync without any difference

These errors are showing in the log: non

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [July 5, 2024, 11:49am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/2 "2024-07-05T11:49:19Z")

</div>

Hi @cremigerhonig,

If you developed your email from scratch using HTML, did you validate all the code to ensure it was error-free?

Also, check the error log of your Mautic installation to see if anything unusual catches your eye. This will help ensure there are no issues with your Mautic setup.

I strongly recommend using MJML to develop your emails. MJML is a markup language designed to simplify the process of coding responsive emails, and it’s easy to learn. This approach will integrate better with the GrapeJS builder in Mautic, making it easier to edit your custom themes or code.

I hope this helps in some way.

Best regards,  
Ricardo

_PS: There’s no need to comment on different posts and link to this one._

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 5, 2024, 4:21pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/3 "2024-07-05T16:21:19Z")

</div>

Thank you for your answer!

Regarding the email template issue:

- The code is error-free and has been checked multiple times.
- The Mautic installation is also error-free.
- There are no errors in the log.

We have a few specific questions and preferences:

1. Why does Mautic add unnecessary CSS?
2. We do not want to use the GrapesJS builder; instead, we prefer to use the Mautic builder.
3. The template we are using is HTML-based.

Thank you for your assistance.

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [July 9, 2024, 4:45pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/4 "2024-07-09T16:45:50Z")

</div>

> [@cremigerhonig](#):
>
> Why does Mautic add unnecessary CSS?

When you open your email for editing in the GrapesJS builder, it automatically adds classes and the “unnecessary CSS” you mentioned. It’s crucial to always test the email using the GrapesJS builder. In MJML, this becomes easier to understand.

> [@cremigerhonig](#):
>
> 1. The template we are using is HTML-based.

If your email doesn’t require specific HTML, you should consider using MJML for a simpler approach. It’s also easier to edit the code compared to using table elements. I recommend taking a look at MJML before deciding against it. However, Mautic supports both HTML and MJML.

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 10, 2024, 5:20am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/5 "2024-07-10T05:20:51Z")

</div>

> When you open your email for editing in the GrapesJS builder, it automatically adds classes and the “unnecessary CSS” you mentioned.

I am using the Mautic builder, not GrapesJS, to open the email. The issue is that Mautic Builder continuously adds unnecessary CSS every time I save, causing the email to bloat.

I’ve attached the code earlier for your review. Please take a look:

> Theme code (3 or more times saving) after sent to user: [gist:aba304e4c560a60352f9c98273a009aa · GitHub](https://gist.github.com/cremigerhonig/aba304e4c560a60352f9c98273a009aa)

As you can see:  
Theme after 1 save: 2,152 lines  
Theme after 3 saves: 11,976 lines

That’s a sixfold increase in size, filled with unnecessary CSS that accumulates with each save.

As I see it, Mautic isn’t able to recognize that it has already added the “necessary CSS” once, and it keeps bloating the email with each save. This issue is not about using MJML since Mautic supports both MJML and HTML. The HTML template has been minimized and checked for correct code, but the problem persists.

Oh and this behaviour was not there with mautic 4 and previous using the exact same template… So blaming the template is not the way we will handle this 😉 (anyway, if you have suggestions on the template, they are welcome)

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [July 10, 2024, 3:02pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/6 "2024-07-10T15:02:56Z")

</div>

If you believe it is a bug report it on [Mautic Github](https://github.com/mautic/mautic/issues).

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 10, 2024, 3:26pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/8 "2024-07-10T15:26:33Z")

</div>

thank you

done

> <https://github.com/mautic/mautic/issues/13941>
>
> \### Mautic Version
> 
> 5.0.x series
> 
> \### Way of installing
> 
> I downloaded a re…lease from https://www.mautic.org/mautic-releases
> 
> \### PHP version
> 
> 8.1.29
> 
> \### What browsers are you seeing the problem on?
> 
> Not relevant
> 
> \### What happened?
> 
> Your software
> My Mautic version is: 5.1
> My PHP version is: 8.1.29
> My Database type and version is: 10.6.18-MariaDB
> 
> Your problem
> My problem is:
> 
> I created a custom mautic email theme that worked perfectly in Mautic 4, allowing me to send and edit this emails without any issues. However, after upgrading to Mautic 5, I encountered a problem where the emails would stop sending without any apparent reason after editing or saving the theme three or more times.
> 
> Here are some details:
> 
> Sending the (not edited) theme directly to a segment works fine initially, with emails sent in batches of 100 to 149 users.
> 
> \[Imgur: The magic of the Internet 2\](https://imgur.com/WXYRIfL)
> \[Imgur: The magic of the Internet 1\](https://imgur.com/MKcdFWX)
> 
> Opening, editing and saving the theme once works without issues. I can still use the “auto-generate” function for the text version of the email and send it without problems.
> 
> \[Imgur: The magic of the Internet 1\](https://imgur.com/UBlA3Dd)
> 
> However, if I open and save the theme three or more times, the email stops sending. Additionally mautic creates a 503 error on sending.
>     
> After update from 5.0 to mautic 5.1 the 503 is gone but still, the text version generation fails. If I attempt to send it anyway, the process halts at around 40 emails without any error message, indefinitely.
> 
>     
> When I return to the email tab, it doesn’t show that the emails were sent in the overview. Clicking on the email shows that some emails were indeed sent, but continuing the sending process only sends about 40 more emails each time without updating the overview. If I repeat this step multiple times, eventually all emails are sent, though they still don’t appear in the overview.
>     
> The statistics are not usable and wrong.
> 
> Overview: \[Imgur: The magic of the Internet\](https://imgur.com/F1vMgwW)
> Statistics: \[Imgur: The magic of the Internet\](https://imgur.com/NmeBt3t)
> 
>     
> Inspecting the email’s source code reveals that Mautic adds strange CSS code (presumably each time I save the template), which may be increasing the email size until it becomes too large to send.
> 
> my theme: \[https://mautic.vaegabond.com/email/preview/154 1\](https://mautic.vaegabond.com/email/preview/154)
> 
> Theme Only code (without saving) after sent to user:
> \[--gjSlLf87Content-Type: text/plain; charset=utf-8Content-Transfer-Encoding: - Pastebin.com 1\](https://pastebin.com/tKnmLVQV)
> Theme code (3 or more times saving) after sent to user:
> \[gist:aba304e4c560a60352f9c98273a009aa · GitHub 1\](https://gist.github.com/cremigerhonig/aba304e4c560a60352f9c98273a009aa)
> 
>     
> Another issue I’ve noticed is that when I open the theme in the Mautic builder (not GrapesJS), I can’t edit the template right away; I have to save it once before editing becomes possible. I’m unsure why this behavior occurs.
> 
> None of these issues were present in Mautic 4, where the same theme functioned perfectly.
> 
> Settings in Mautic:
> Queue for email set to doctrine
> Imgur
> before it was also set to sync without any difference
> 
> These errors are showing in the log: non
> 
> 
> 
> Relevant topis:
> https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651
> 
> 
> \-----------Additional Info:
> 
> I am using the Mautic builder, not GrapesJS, to open the email. The issue is that Mautic Builder continuously adds unnecessary CSS every time I save, causing the email to bloat.
> 
> I’ve attached the code earlier for your review. Please take a look:
> 
>     
> Theme code (3 or more times saving) after sent to user: \[gist:aba304e4c560a60352f9c98273a009aa · GitHub 1\](https://gist.github.com/cremigerhonig/aba304e4c560a60352f9c98273a009aa)
> 
> As you can see:
> Theme after 1 save: 2,152 lines
> Theme after 3 saves: 11,976 lines
> 
> That’s a sixfold increase in size, filled with unnecessary CSS that accumulates with each save.
> 
> As I see it, Mautic isn’t able to recognize that it has already added the “necessary CSS” once, and it keeps bloating the email with each save. This issue is not about using MJML since Mautic supports both MJML and HTML. The HTML template has been minimized and checked for correct code, but the problem persists.
> 
> Oh and this behaviour was not there with mautic 4 and previous using the exact same template… 
> 
> \### How can we reproduce this issue?
> 
> Step 1: use my template
> Step 2: save it several times
> Step 3: Send it to yourself and see what happend to CSS between original Template and sent template
> 
> \### Relevant log output
> 
> \`\`\`shell
> no errors
> \`\`\`
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 23, 2024, 8:25am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/9 "2024-07-23T08:25:31Z")

</div>

can you have a look at the template please?

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [July 23, 2024, 3:03pm UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/10 "2024-07-23T15:03:25Z")

</div>

Send me a message on Mautic’s Slack, I will try to help you out. 🙂

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [July 24, 2024, 6:46am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/11 "2024-07-24T06:46:57Z")

</div>

how can I do this?

Also see here: same issue but better documentation

> <https://github.com/mautic/mautic/issues/13452>
>
> \### Mautic Version
> 
> 5.0.x series
> 
> \### Way of installing
> 
> I downloaded a re…lease from https://www.mautic.org/mautic-releases
> 
> \### PHP version
> 
> 8.1.27
> 
> \### What browsers are you seeing the problem on?
> 
> Not relevant
> 
> \### What happened?
> 
> The classic email builder adds and repeats unexpected code especialy &amp in the email every time it is saved (or cloned), which grows to the point that the email saving can crash with a JavaScript error and e-mail size will extend very hard with this evertime.
> 
> It happens with the blank template but also with own / or custom templates.
> 
> 
> \### How can we reproduce this issue?
> 
> Step 1: Create a new email with the legacy builder.
> Step 2: Choose the default Blank or another template.
> Step 3: Modify something and save the email.
> Step 4: After saving the email check what was saved in: ##\_\_emails table to the field custom\_html
> Step 5: The content of the field custom\_html save for the future compare.
> Step 6: Open the email with Builder, modify something and save again.
> Step 7: After full saving the email check what was saved the the ##\_\_emails table to the field custom\_html and compare with previous state of the data
> 
> 
> 
> 
> \### Relevant log output
> 
> !\[Scherm­afbeelding 2024-02-23 om 14 32 45\](https://github.com/mautic/mautic/assets/17729447/9eaa5736-e9c2-409e-8dfa-92a76af747ad)
> !\[Scherm­afbeelding 2024-02-23 om 14 33 15\](https://github.com/mautic/mautic/assets/17729447/50b4e939-a75a-4516-aaf0-27f499e5017e)
> 
> \[email\_html\_issue.zip\](https://github.com/mautic/mautic/files/14385810/email\_html\_issue.zip)
> 
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [July 24, 2024, 10:03am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/12 "2024-07-24T10:03:48Z")

</div>

I don’t want to sound rude, but the legacy builder is probably not going to be updated, as we transitioned to GrapeJS a few **years ago**.

I hope the team can fix it, but we lack the human resources to assist. Managing visual builders is a complex and time-consuming task that requires extensive testing and a tester to validate everything.

If you could help with testing on GitHub, or even contribute code, it would be greatly appreciated.

Additionally, remember that Mautic is a platform that requires **frequent updates** to stay aligned with the latest **advancements** in the email marketing world. Using MJML/GrapeJS Builder is a step forward to not only remain modern but also to adhere to these advancements. It’s essential for companies to update their email templates regularly, as creating a template a few years ago and leaving it unchanged is not a sustainable approach.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 24, 2024, 10:22am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/13 "2024-07-24T10:22:02Z")

</div>

Hi, are you using spellchecker or AI plugins in your browser?  
They are injecting data sometimes.

J

---

<div class="post-metadata">

**Author:** ![cremigerhonig](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cremigerhonig](https://forum.mautic.org/u/cremigerhonig)\
**Post date:** [September 2, 2024, 9:25am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/14 "2024-09-02T09:25:25Z")

</div>

Hi ricfreire,

can you help me to adjust the template? How can I text you on “mautic slack”  
Can I email you in some way?

@joeyk no, not using and not related to this

---

<div class="post-metadata">

**Author:** ![ricfreire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ricfreire/32/14973_2.png) [@ricfreire](https://forum.mautic.org/u/ricfreire)\
**Post date:** [September 2, 2024, 9:53am UTC](https://forum.mautic.org/t/not-sending-emails-adding-various-css-to-mails-sending-email-create-503-error/32651/15 "2024-09-02T09:53:41Z")

</div>

Sure I could help you out. You can send me an email on [ricardo@ferreh.com](mailto:ricardo@ferreh.com) or you can enter into Mautic Slack by clicking [here](https://mau.tc/slack-invite), and drop a message there. My name is Ricardo Freire there as well.
