I have HTML e-mail templates stored in a MySQL database. Most of them include JavaScript variables. I tried to store them using template literals (i.e.: ${this.auth.user.name}
) but this will not return the variable but the exact string. I assume my problem is because the string is encapsulated by double quotes or single quotes and not back-ticks.
So my JavaScript looks the following, where template
is an array of objects queried from my MySQL show here.
var email_template: this.template[0].body;
The actual output is Hello ${this.auth.name}!
I expect the output of Hello Jack!
Do you have any ideas what could be the problem?
Thanks in advance, Tibor