Background of email-template

Hi all!

Where do i find the base for the email-template? I would like to get rid of the gray #444444 background and center aligment.

Also the “plain text” option seems to strip single newlines…

I’m using 7.11.18

That depends on which Email editor you have selected in user profile, and on which screen you’re calling this from, how you’re sending the email, and which template you’re using.

Sorry, but this is a convoluted area of SuiteCRM…

Sorry, you are completely right… I forgot to explain more in detail.

If i create an email-template in the EmailTemplates-module, and later send the email via Emails->Compose. Here i pick the template i created, choose a contact, and send the email.

The sent message get’s formatted with the #444444 coloured background, and the message centered. If i pick “Send in Plain Text”, the sent message get’s formatted without the newlines as in the template itself…

A shortcut to understand what’s happening would be to go in the database, email_templates table, and see if the #444444 is there.

Another thing is getting access to that from the Email Templates window, which should be possible, but sometimes gets confusing due to the email editors. I assume you have TinyMCE there. Sometimes TinyMCE shows a button to check source HTML, but I’m not sure it’s there in that screen…

Hi,
no, Tiny MCE has not the extra source-button available. Would be though good to have it there. I try to find the place where TinyMCE:s parameters are set so that i can enable that button

I’m afraid the source button might not solve everything, because there is more (somewhat chaotic) code running from several bits of JavaScript.

Anyway you can try tweaking the settings from modules/Emails/include/ComposeView/EmailsComposeView.js, you’ll find some bit there already playing with TinyMCE.

You can make upgrade-safe customizations of this file in custom dir.

In my work for PowerReplacer add-on I ended up removing TinyMCE altogether, and just using a direct HTML editor, to avoid any changes to what I put there…

But don’t forget just checking the database to see if the #444444 is there. There’s a vague chance it’s not coming from the Email Templates module, but rather from the Compose window, or maybe it’s just a class in the template that catches some leaked CSS from the main style.css.

Hi,
You can go to email template module and from there open your particular email template and there select the text format which you want and click on it, then after hover your mouse on left of the text you will notice options to select the background color. From there you can change the color of the email template background.

2 Likes

Hi,
Thanks for the tip. That worked now out for the background. There is though some issues that i can’t seem to figure out. Now that i tweaked the settings for the TinyMCE-editor, i can edit the source of the message body. From somewhere it still appends to headers (H2) and and paragraps § stuff that i don’t want to have in the source:

I create the next template-body edited as source. Sorry if i the source looks bad. could not figure out how to the wierd html-tags. I could not figure out how to get them written properly in this editor…

< h2>Hi $contact_name< /h2>
< p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tempus odio ante, in feugiat ex pretium eu. In pharetra tincidunt urna et malesuada. Etiam aliquet auctor justo eu placerat. In nec sollicitudin enim. Nulla facilisi. In viverra velit turpis, et lobortis nunc eleifend id. Curabitur semper tincidunt vulputate. Nullam fermentum pellentesque ullamcorper.< /p>

After i save the template, and re-open the template, the source looks now like this:

< h2 style=“font-family: Arial, Helvetica, sans-serif; font-size: 18px; line-height: 28.8px; color: #444444; padding: 0px; margin: 0px;”>Hi $contact_name< /h2>
< p style=“font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22.4px; color: #444444; padding: 0px; margin: 0px;”>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tempus odio ante, in feugiat ex pretium eu. In pharetra tincidunt urna et malesuada. Etiam aliquet auctor justo eu placerat. In nec sollicitudin enim. Nulla facilisi. In viverra velit turpis, et lobortis nunc eleifend id. Curabitur semper tincidunt vulputate. Nullam fermentum pellentesque ullamcorper.< /p>
< div class=“mozaik-clear” style=“font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22.4px; color: #444444; padding: 0px; margin: 0px; height: 0px;”> < /div>

It get styles appended to the tags + an additional div-tag at the end. I wonder from where these are coming…

When i now create an email based on this template via the Email-module->Create->pick the template->Accept warning that body+subject will be replaced, the source looks like this:

< !DOCTYPE html>
< html>
< head>
< /head>
< body>
< div class=“mozaik-inner” style=“max-width: 500px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22.4px; color: #444444; padding: 0px 30px; margin: 0px auto; width: 465.633px; background-color: #ffffff;”>
< h2 style=“font-family: Arial, Helvetica, sans-serif; font-size: 18px; line-height: 28.8px; color: #444444; padding: 0px; margin: 0px;”>Hi $contact_name< /h2>
< p style=“font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 22.4px; color: #444444; padding: 0px; margin: 0px;”>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tempus odio ante, in feugiat ex pretium eu. In pharetra tincidunt urna et malesuada. Etiam aliquet auctor justo eu placerat. In nec sollicitudin enim. Nulla facilisi. In viverra velit turpis, et lobortis nunc eleifend id. Curabitur semper tincidunt vulputate. Nullam fermentum pellentesque ullamcorper.< /p>
< /div>
< /body>
< /html>

What i can’t figure out is what to edit so that i can get rid of the appended styles or alternatively modify them to my needs…

One other detail that i noticed. I can’t create an email from the contact. The template does not get pasted into the body-field, and the field itself has some formatting-problems, because it get’s pushed outside of the main frame (i deleted To, From etc from the screenshot)

The last issue you mention is a known issue in the latest versions, there’s a fix available.

About the HTML changes, you’re going into very delicate territory here… changes can be happening…

  1. Made by TinyMCE, might be solvable with TinyMCE configs. Things like linebreaks and adding HTML tags.

  2. Made by Javascript code on those screens - hard to find, and could be anything.

  3. Made by the back-end, especially pseudo-security clean-ups. Things like quoting, escaping or removing tags.

I applied the diff to my 7.11.18, but that did not work out…

Regarding the styles getting filled in, it would be good to have a place where to control what’s being sent as an email…

I think there’s a second issue linked from that one, with an extra bit of fixing…

About the styles, I think this area of SuiteCRM is out of control, and requires extensive work to bring to a state where it’s useful. That’s what I’ve been doing with my add-on. My initial intent was just to add variable-replacement capabilities, but I got dragged into fixing bugs and solving editor problems. I don’t think WYSIWYG is a good paradigm for HTML email. It’s more complex than that, and we need more control. I’m all for direct plain text editing of content, and using the templating features (not WYSIWYG) to make it easy on the user. I’m sorry but I can’t translate all the work I did for over a month on this into Forum advice for simple tweaks… it’s just not possible.

1 Like

Wow… i discovered this option in my Profile settings: Editor -> DirectHMTL… I wonder how long time this option has been there. I have completely missed it! This is EXACT what i was looking for!! Now i have full control of my email-templates :slight_smile:

1 Like