Altered Process Email Template when sent

Hello,

We noticed that the process of email sending from Sugar is altering the html code of the email template.

We use Process Email Template to send some transactional emails to clients. These templates are designed in another tool and we get the html at the end of the design.

First problem is when you copy-paste the html in the process email template : the code is altered by TinyMCE. We overrode the html_tinymce field to allow style tags for example, so that the template still looks good after having saved the code.

But we still lose the head part of the html code. Unlike classic email templates, we can't manage the whole html but only the body part

Is there a way of defining the whole html in process email template ?    

Thank you,

Sylvain

  • Sorry Sylvain, I cannot help here, where I work we don't use Sugar email templates at all.

  • I believe this is a limitation of the implementation of TinyMCE in Sugar and is the subject of Enhancement Request 73763. However that is purely a documentation request regarding what is stripped from the source by the purifier in Sugar when HTML is pasted and saved. (I think there is a size limit however this probably will not affect Process Emial Templates, just Campaign Email Templates).


    SugarCRM recommended that we get a visual diff program (for example, PSPad can do this on Windows) and copy the Sugar version of the source code to a text file, then compare it to the original using the diff functionality. That doesn't help the fundamental problem that there are limitations when pasting HTML that really need to be addressed as a priority by SugarCRM in my opinion. Unfortunately there is no workaround other than to simplify the HTML.

    Suggest you log a case with SugarCRM and get it linked to the existing ER. Alternatively we can create a product suggestion in SugarClub and get votes for it so it gets addressed.   

  • Hello,

    Thank you all for your answers.

    We finally managed to get a correct rendering in Outlook, here is what we've put in place:

    - activation of the TinyMCE fullpage plugin (thank you ) : to do this you need to override the compose view of the pmse_Emails_Templates module, file custom\modules\pmse_Emails_Templates\clients\base\views\compose\compose.php :

                    array(
                        'name'          => 'body_html',
                        'type'          => 'pmse_htmleditable_tinymce',
                        'dismiss_label' => true,
                        'span'          => 12,
                        'tinyConfig'    => array(
                            'height' => '400',
                            'plugins' => 'code,textcolor,link,fullpage',
                            'toolbar' => 'code | bold italic underline strikethrough | bullist numlist | ' .
                                'alignleft aligncenter alignright alignjustify | forecolor backcolor | ' .
                                'fontsizeselect formatselect | link | sugarfieldbutton sugarlinkbutton',
                        ),
                    ),
                ),
            ),
    
        ),
    );

    (added ",fullpage" in the plugins entry)

    - customization of the htmleditable_tinymce field : custom\clients\base\fields\htmleditable_tinymce\htmleditable_tinymce.js

    ({
        extendsFrom: "Htmleditable_tinymceField",
    
        /**
         * Returns a default TinyMCE init configuration for the htmleditable widget.
         * This function can be overridden to provide a custom TinyMCE configuration.
         *
         * See [TinyMCE Configuration Documentation](http://www.tinymce.com/wiki.php/Configuration)for details.
         *
         * @return {Object} TinyMCE configuration to use with this widget
         */
        getTinyMCEConfig: function(){
            var config=this._super('getTinyMCEConfig',[]);
            //ajout d'éléments "valides" supplémentaires
            config.extended_valid_elements = 'style[dir|lang|media|title|type],hr[class|width|size|noshade],@[class|style]';
            //protection des balises <!--[if ...]> et <![endif]--> qui sont transformées sinon (ajout d'un espace qui n'est pas compris par Outlook)
            config.protect = [
                /\<!--\[if .*\]\>/g,   // Protect <!--[if .*]>
                /\<!\[endif\]\-->/g   // Protect <![endif]-->
              ];
            return config;
        }
    
    
    })
    

    - not necessary for my case, but if you want to inactivate HTML purifier you can do this core modification (not upgrade safe) : file include\clean.php

    static public function cleanHtml($html, $encoded = false)
        {
            
            return $html;