I'm trying to customize my e-mail templates using the Mailjet Passport tool. The HTML code generated by Passport Drag and Drop tool, supports templating language that is similiar to Twig.
What I need to achieve is to put variable for inline style property like on the code example below:
<span
style="color: {{var: PARTNER_COLOR:"#d2d2d2"}};" // it does not work
>
Lorem ipsum {{var:PARTNER_NAME:"Default Partner"}}.mywebstite.de <!-- this work as expected -->
</span>
Interpolating the {{var:VARIABLE_NAME}}
within inner HTML content or for src
attribute works as expected, but I'm not able to figure out how to use them with the style
attribute.
Maybe there is some other solution for dynamically changing color values for css color
, background
properties in my e-mail templates?
Docs are very poor to be honest, but here is the reference: Maijlet Templating Language Docs
After couple of days I have finally found and answer. For anyone looking for this in the future there can't be any space sign before the curly braces and var declaration like in the example below:
BAD:
<span
style="color: {{var: PARTNER_COLOR:"#d2d2d2"}};" // it does not work
>
Lorem ipsum {{var:PARTNER_NAME:"Default Partner"}}.mywebstite.de <!-- this work as expected -->
</span>
GOOD:
<span
style="color:{{var:PARTNER_COLOR:"#d2d2d2"}};" // THIS WORKS!
>
Lorem ipsum {{var:PARTNER_NAME:"Default Partner"}}.mywebstite.de <!-- this work as expected -->
</span>