Mails styles stripped only partially so mails are unreadable


  • Used Zammad version: 5.0
  • Used Zammad installation type: package
  • Operating system: Ubuntu
  • Browser + version: All

We have a client that sends mails from their system that contain html + css.
Their whole message is in a td in a table, and this td has the following style: ‘style="background: #fff; color: #fff;’, and then all the paragraphs have "style=“color: #000000;”’

So a mail from them will look something like:

<table style="max-width: 100%; min-width: 320px; display: block;" width="100%" cellspacing="10px" cellpadding="10px">
<td style="background: #FFF; color: #fff;" width="506">
<p style="line-height: 140%; font-size: 20px; font-family: Helvetica Neue,Arial,sans-serif; padding: 10px 30px 0 30px;"><span style="color: #000000;">TEXT</span></p>

<p style="color: #fff; line-height: 140%; font-size: 12px; font-family: Helvetica Neue,Arial,sans-serif; padding: 00px 30px 0 30px;"><span style="color: #000000;">TEXT&nbsp;</span><br /><br /><span style="color: #000000;">TEXT</span></p>

The problem is that Zammad strips all the styles, excepting the styles on the table and td, so the color of the text remains white.

<table cellspacing="10px" cellpadding="10px">
<td style="background: #fff; color: #fff;">

I know that it’s an unusual way of sending mails, but nonetheless, the text should be visibile.

Expected behavior:

  • I would expect that either all styles are stripped, or none. By stripping only some styles, the mail contains is unusable. For example, if some “color” styles are kept, all “color” styles should be kept. If a concern is that some styles could modify the page, maybe all styles can be parsed and moved to clases with unique names, and have those classes added only to the original mail so they do not bleed.

Actual behavior:

  • The mail cannot be read. It contains only white text. By highlighting it we can see the message.

Steps to reproduce the behavior:

  • Receive a mail with the given HTML and it will be a white box :).

What can we do for the moment so we can see the mails from this client?


Sorry there’s not really something we can do about that.
The community complained about Zammad stripping out colors - now you got colors and this is what I’ve been telling everyone all the time.

Zammad does not have any way of checking if the font color does not work with the background color, so sorry, your customer may start writing proper mails if you’re lucky.

Thanks for your response!

The problem is not that the colors don’t match the background. The problem is that some colors are stripped and some not, so this gives inconsistency. All colors should be stripped, or none, but in my example, only some colors are taken out.

The color on the td style is left intact, but the color on the span is removed by Zammad, and this gives the problem.
This customer sets the color for td white, and then each span has a color: black, so the mail is ok without removing some styles.

Zammad should remove all styles, or none. Removing the styles partially gives the problem. Is there a way to disable or enable styles stripping?

There’s no way to disable Zammads HTML sanitizing partly or entirely.
The Sanitizers job is to ensure the UI stays usable while displaying HTML content.

This is why at some points it is more strict than an end user would like to accept.
Please create a bug report as I do agree that this kind of behavior should be improved.

related; Option to turn off email body reformat? - #8

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.