salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.53k stars 2.09k forks source link

Issue on saving plain html code in email templates #3797

Closed squestel closed 7 years ago

squestel commented 7 years ago

Issue

I try to generate an email template from html/css code, on saving everything disappear

Expected Behavior

Of course I expect the html page to be saved properly and keeping the css like it's meant to be

Actual Behavior

I get a white page, like the default model

Possible Fix

I suggest that the html check doesn't reject a plain html code (<!DOCTYPE HTML>......)

Context

It's a high priority because we take our tme to make a complete html template for our emails, and suitecrm rejects it !

Your Environment

Would you please tell me where to modify the check system on click on the save button so it can accept my html content

Dillon-Brown commented 7 years ago

@squestel I am unable to replicate this. Is there a specific example of html code that you could give?

squestel commented 7 years ago

It's the only way I managed to give you my code..

Just another precision, when I only keep the body with the style tags, I can save it, but doesn't display properly.

Here's our code : html issue.docx

Dillon-Brown commented 7 years ago

@squestel It seems to be saving correctly with that code, apart from some formatting issues that are due to the issue here: https://github.com/salesagility/SuiteCRM/issues/3672

squestel commented 7 years ago

Here's what we get, on multiple instances :

As I said, it gets saved only when we remove some html tags, but we lose the css So we need the entire code to be saved

expected_on_save result_on_save

squestel commented 7 years ago

With that being said, would you please tell me which part of the php code I have to modify in order to bypass the html purifier.

Here's a post on the suitecrm forum about this issuen from a long time ago and still not fixed : https://www.suitecrm.com/forum/feedback/11443-email-template-editing

Thanks

janbarendse commented 7 years ago

I also noticed that the htmlcode gets truncated to a certain amount of bytes, made my responsive html mail to fail.

Dillon-Brown commented 7 years ago

@janbarendse That sounds like a bug. Can you raise a new issue for it?

Dillon-Brown commented 7 years ago

@squestel From what I can see from your screenshots the issue is actually due to using the Mozaik editor, the html purifier won't be causing the template to appear blank. This is most likely due to making a change in Mozaik that caused the html code to be outside the mozaik "block". For existing templates you would want to use the Direct HTML editor that you can find under email settings in user profile.

This doesn't appear to be a bug so i'll be closing the issue. If you are able to replicate the direct HTML editor returning a blank template then please re-open. Thanks.

squestel commented 7 years ago

Hi,

I'm not sure I understand what youre telling me to do, I actually tried to go to email parameters in the admin section (in french), and uncheck all the tags, save and repair ( just in case) and I still get a blank page : issue

Dillon-Brown commented 7 years ago

@squestel Hi, the option to change editors can be found under user profile here:

github_editor

If you already have an HTML template you will want to use the "Direct HTML" option as using "Mozaik" will break the html.

squestel commented 7 years ago

Here's what I get on 7.8.5 version : issue

Dillon-Brown commented 7 years ago

@squestel My apologies, I mistakenly thought you were on 7.9. I've created a fix here: #3817 that should have resolved email templates returning blank. However, it seems that the template code you provided is still causing issues, this may indeed be a seperate bug. I'll play around with it a bit and see if I can figure out what exactly is going on.

squestel commented 7 years ago

Thanks for caring, unfortunately after doing your changes, and repairing, on two different instances, I still get a blank page ( at the repair i've been proposed to execute sql queries ).

tlosio commented 7 years ago

Hi,

I also have the exact same problem, in our corporate we need to use our custom Html template for campaigns but that's not possible currently because the module mess up our template structure on saving. That's urgent we can't afford to lose our time doing back our template for productivity sake.

Would you please help me out.

Thanks in advance.

Dillon-Brown commented 7 years ago

@tlosio What version of SuiteCRM are you on? are you getting the same issue regarding a blank page or just template formatting?

tlosio commented 7 years ago

Thanks for answering, I actually recently upgraded to 7.8.5 but I used to get the same issue on 7.8.3.

On saving a complete html or mine, it gives me a blank page, and when taking off the "!DOCTYPE html etc..." ( maybe < html > too ? ), I have a really strange display on saving because I saw that SuiteCRM adds new html tags ( ex : < tbody > ) so he plays around with my html code and that really sucks.

As I see, we seem to be a lot who complain about this thing regarding SuiteCRM... Hope it will get fixed pretty soon....

dl3737 commented 6 years ago

we have now vesion 7.9.12 and still have the same problem. I think it will not be solved! although email template is very important in CRM programe.