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

Parents
  • 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;

Reply
  • 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;

Children
No Data