Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to pass full html into a email transactional message body

Avatar

Level 1

I am setting up a transactional message template that is triggered off of a rtEvent. I would like to populate the template with an html block but in order to pass html as an XML value I have to base64 encode it. How to I decode it in my template? 

I've tried sending the html both of the following ways:

 

<ctx>
  <emailcontent> 
  htmlbody=<![CDATA[<html><head></head><body>Your HTML's body</body></html>]]></emailcontent>
</ctx>


<ctx>
  <emailcontent htmlbody="PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5PllvdXIgSFRNTCdzIGJvZHk8L2JvZHk+PC9odG1sPg=="/>
</ctx>

 

This is how Im displaying the html in the email template 

<%= rtEvent.ctx.emailcontent.@htmlbody %> 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 6

First, I don't think that you can do it standard Adobe as the toBase64() method is exposed but not the reverse:
toBase64 (adobe.com)

Netherless, this is not a good practice at all to use Message Center this way:
creating personnalization based on a huge field (or even complexe personnalization) will slow down the treatment of your messages by the MTA.
Best practice would be to incorporate the HTML directly in the template and to use "case" of "if" condition in JS depending of your CTX.

Using the personnalization data (ctx / targetData) for html injection is never something Adobe Campaign (message center or not) loves to do: it can act as a PHP server but its goal is too generate emails as quick as possible

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

First, I don't think that you can do it standard Adobe as the toBase64() method is exposed but not the reverse:
toBase64 (adobe.com)

Netherless, this is not a good practice at all to use Message Center this way:
creating personnalization based on a huge field (or even complexe personnalization) will slow down the treatment of your messages by the MTA.
Best practice would be to incorporate the HTML directly in the template and to use "case" of "if" condition in JS depending of your CTX.

Using the personnalization data (ctx / targetData) for html injection is never something Adobe Campaign (message center or not) loves to do: it can act as a PHP server but its goal is too generate emails as quick as possible