Macros in email template(s) getting corrupted

Tomislav Stipić asked on June 21, 2021 12:45

Hello.. I don't know what is going on and will offer all the info I can fathom is relevant.

I have created an email template and the template has macros in it which resolve certain links. The macros work fine, for a while. Now again, for the 2nd time, the macros have broken and have turned from:

href="{% GetResourceString("dd.newsletter.footer.linkedin.url") #%}

To:

href="{% GetResourceString(" dd.newsletter.footer.linkedin.url")="" #%}"=""

This pattern repeats many times and in all of its instances the same thing has happened, resulting with all of the links being "www.siteName.com/false".

I've noticed that another macro gets murdered;

From this:

{% GetResourceString("dd.hcemail.footer.facebook.url") == "pending client" ? "style='display:none'" : "" #%}>

It turns into this:

{%="" getresourcestring("dd.hcemail.footer.facebook.url")="=" "pending="" client"="" "style='display:none' :="" ""="" #%}="">

That actually made me laugh. What is going on?

Recent Answers


Juraj Ondrus answered on June 21, 2021 13:37

Where and how are you adding the macros? This sounds to me like the WYSIWYG editor is trying to fix the markup - the issue should be between the quotes and single apostrophes. I would maybe try using apostrophes in the first example for href attribute:
href='{% GetResourceString("dd.newsletter.footer.linkedin.url") #%}'

And for the other macros, I would maybe try using open condition statements:
{%if (GetResourceString("dd.hcemail.footer.facebook.url") == "pending client") { %} style='display:none' {%} else {""}%}

0 votesVote for this answer Mark as a Correct answer

Tomislav Stipić answered on June 21, 2021 14:30

Hey Juraj,

The macros are added inside of an email template editor. Thank you on your advice. I have changed everything as per your instruction. It's important to note that the macros work for a while, so I don't think that the WYSIWYG editor has anything to do with this at all. The macros stop working later at a seemingly random time.

0 votesVote for this answer Mark as a Correct answer

Tomislav Stipić answered on June 28, 2021 15:44 (last edited on June 29, 2021 09:10)

The macros have broken in the same way again. Using the "open condition statements" didn't remove the cause of the issue..

It's now turned into this

<a href='{% GetResourceString("strings.facebook.url") #%}' target="_blank" rel="noopener noreferrer" data-auth="NotApplicable" {%="" if="" (getresourcestring("strings.facebook.url")="=" "pending="" client")="" {="" #%}="" style='display:none' {%}="" else="" {""}|(identity)globaladministrator%}="">

Basically, these things ="" are being randomly added after everything inside of a macro and are destroying all functionality.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on June 30, 2021 06:56

This is really strange. What happened in the mean-time? Are you using staging, web farms, export/import, etc.? What other changes were made you can think of? Are you using always the same browser? If yes, are there any plugins/addons? I would maybe try using some other browser or disable the plugins for some time to see if they are interacting somehow.
Also, are the corrupted values also saved into the DB in the CMS_EmailTemplate table? If yes, then there is something which is saving the corrupted data - any custom code or integration in place? Even if it sounds unrelated...

0 votesVote for this answer Mark as a Correct answer

Tomislav Stipić answered on July 9, 2021 14:52

I can't answer you Juraj because I don't have the technical know-how, I will answer as soon as I know.

0 votesVote for this answer Mark as a Correct answer

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