Email Macro & Transformation

Seb Mash asked on May 24, 2017 11:05

Hello,

I have a problem regarding emails interpreting special characters like '<' or '"' as &lt and &quot.

Here's what I'm doing :
I have a DataRowCollections that I'm passing to my MacroResolver.

Within my email template, I'm applying a transformation (Text/XML) on that DataRowCollection.
Transformation call in the mail template : {% itemData.ApplyTransformation("custom.transformations.TestRpt")#%}
Transformation code :
<tr style="background-color:#f1f1f1;padding:5px 10px;">
<td>{% itemNumber%}</td>
<td>{% itemName %}</td>
<td>{% itemTotalPrice %}</td>
</tr>

When I receive the email, the values contained inside itemNumber, itemName and ItemTotalPrice are correct.

BUT the html tags are not interpreted as HTML but as plain Text !

So instead of having <td>abc</td> I get "<td>abc</td>"

How can I fix this?

Correct Answer

Pavel Jiřík answered on May 24, 2017 13:13

Hi Seb, could you try to disable HTML encoding for your macro to see if that helps?

{% itemData.ApplyTransformation("custom.transformations.TestRpt")|(encode)false |(identity)GlobalAdministrator%}

This way, it shouldn't encode the HTML tags and therefore return expected HTML format.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Prashant Verma answered on May 24, 2017 11:45

Hi Seb,

The way you are using transformation and marco in email template is correct. only the problem I believe due to macro not resolving in email template properly check with kentico hot-fix version 10.0.4 for macro fixes read bug resolved in different version's.

https://devnet.kentico.com/download/hotfixes

Thanks

1 votesVote for this answer Mark as a Correct answer

Seb Mash answered on May 24, 2017 11:53

The version I'm currently using is the 10.0.8, so this doesn't help me unfortunatly

0 votesVote for this answer Mark as a Correct answer

Seb Mash answered on May 24, 2017 13:44

Thanks Pavel Jiřík, your solution fixed the issue !

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.