Conditional HTML Tags getting striped

Hello,

how are you?

I am having trouble sending my mails with Mailwizz as I cannot get the conditional tags in the mail.

Tags such as:

Code:
<!--[if (gte mso 9)|(IE)]>
            <table width="590" align="center" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
<![endif]-->

Are stripped by Ckeditor. I did not find a fix or an explanation for this.

I would be grateful for a solution as such tags are vital for proper outlook rendering.

Regards!

EDIT: I tried disabling the CKeditor extension and this problem still persists.
 
Last edited:
Hi there,
I have a similar "issue" . Do you find a way to workaround this ?
I think it is related to htmlpurifer used by Ckeditor.
Those tags should be accepeted by defaut as it is related to Outlook wich is a common mail client.
 
Hello Erollfint,

I started checking around and you are sort of right, it looks like an htmlpurifier issue, yet it is not related to the CKeditor. I believe the html purify process gets done in /mailwizz/apps/common/components/utils/EmailTemplateParser.php

I looked at that file and managed to solve my problem. This is what I suggest to anyone having this issue:

  • Go to the EmailTemplateParser.php file and look for $keepBodyConditionalTags and make this change:
PHP:
public $keepBodyConditionalTags = true;
//Change from false to true
  • Check what happens after the change to see if your issue was solved.
In my case solving it was not that easy...
  • If the problem persists look for $conditionalPatternMatch around line 108 and make the following change:
PHP:
//Comment the original one
//$conditionalPatternMatch   = '/(<!--\[if[a-z0-9\s]+\]>)([^\]]+)?(<!\[endif\]-->)/six';
$conditionalPatternMatch = "/<!--\[if\s(?:[^<]+|<(?!!\[endif\]-->))*<!\[endif\]-->/six";
//Add this one

Doing this last thing worked around the tags issue and I was able to keep them. Yet, even after the fix I am having some outlook rendering quikrs that I would like to discuss with the developer.

Please let us now your results.

I hope this helps.

Cheers
 
You are welcome! I am glad to help

How are you testing your mails in outlook?

I use a platform called Litmus and I am still having some issues. The mail is rendering different when I make a test send than when I copy and paste the html code directly on the platform.

I guess there is another process the html goes through before being sent. I will have to look further into this.

Any additional information or support would be greatly appreciated.

Regards!
 
Hi Ignacio,
I'm not using online platform to test my emailing. I'm using a desktop with several email client install on it.
Do you compare the source of the delivery email with the original ?

To Twisted1919,
What do you mean by "impose some degree of issues". Can you clarify ;-)
Thanks.

cheers
Eroll
 
@Erollflint - How do you manage to install multiple versions of Outlook in the same PC?
I did compare the e-mail source with the original and did not find any mayor flaws or problems. Have you done this? What were your results? Are you having any other kind of trouble besides conditionals? If so let me know.

@twisted1919 - What causes such chokes? Is it the HTMLpurifier? Does the HTML goes through any other parse process than EmailTemplateParser.php before being sent? Is it possible for different recipients of the same campaign to receive a different HTML due to such errors/chokes?

I am currently having trouble with Outloook 2007, 2010 and 2013. What startles me is that when I copy and paste the HTML to be sent all tests seem to be good, but when I do a test send the received mail looks fancy on some versions of outlook. That is why I question if there is any other parse process I should know of.

I hope that we can find a solution together and that this thread can became useful to other people

Regards!
 
@Ignacioport - afaik Htmlpurifier will remove conditional tags, therefore we must preserve them before the htmlpurifier goes into action, and then we need to restore them at the correct location. As you might have guessed, this isn't really easy to achieve.
Maybe you can attach the template you try the tests on and i can test that on my end too.
Is it possible for different recipients of the same campaign to receive a different HTML due to such errors/chokes?
No, this is not possible.
 
@twisted1919 - Yes, I have checked online and what I have found out is that Htmlpurifier removes conditional tags as they are deemed 'unsecure'. I found what you are talking about in the code and attempted to fix it changing the $conditionalPatternMatch variable. After making this change the conditional seemed to be there, at least after saving the template. The problem is that I am not sure if they stay there after being sent.

I will PM you the HTML and some additional information.
 
Back
Top