Styling email templates with base HTML file

0
I wish to apply styling and add images to multiple email templates without having to include all the lines of code in the HtmlBody attribute for every template that I create. I have a base HTML base template file, how do I achieve this? For example one of my templates might have a html string body of: '<p> ......<br/> please click the link below<br/> <a href="{%URL%}">"{%URL%}"</a><br/> etc etc...<br/> </p>' but I want to use a separate HTML file to apply styling and add an image at the bottom without including the content of this file in every HtmlBody string value. <!DOCTYPE html "..."><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head>...</head> <body style ="..."> <style> CSS CLASSES </style> <div class="content"> EMAIL <div class="logo"> IMAGE </div> </div> </body> <html> Ideally I would have one line of code that refers to this file inserted into every HtmlBody attribute that applies the styling and adds the image. Thanks, Tim
asked
2 answers
2

We use a separate file document entity to store HTML mail templates. In the community commons module you have a java action that can convert a file to string so you can use it as a variable in your microflow. Hopefully this helps you in the right direction.

answered
0

I'm thinking you could store that string in a persistent entity with string length unlimited (or whatever you need) then use MxModelReflection to share this attribute in your model and add a token referencing this attribute to your HTML body. Not exactly what you're looking for as you would still have to add the token to all of your templates, but it does allow you to modify the string as needed and reflect the change in all of your templates at once.

answered