this may be a bit of a simplistic question for some of you but I wanted to know how I can format the body text of the email alerts I send out. Currently I just use a plain text string, but it doesn't look particularly professional. I understand (or can read up on) html tags, what I don't understand is how I can enter dynamic data (property values) into the html. The dynamic data can be different every time
so currently I would do something like below where the values in bold are taken from the asset properties.
var params =
subject: "Fault State on ASSET " + source /* STRING */,
from: "email@example.com (do not reply)" /* STRING */,
to: "firstname.lastname@example.org" /* STRING */,
bcc: "email@example.com" /* STRING */,
body: "Remote Asset " +source+" (" + me.MachineName + ") has encountered a fault! [1."+row.eventid+" "+row.description+"]. If problem persists please contact your local supplier"
// no return
Would anyone have a couple of examples, or point me in the direction of some documentation?
Hi! Just include your HTML as part of the body parameter string. Say, you want to write the source in bold:
body: "Remote Asset <b>" +source+"</b> (" + me.MachineName + ") has encountered a fault!"
If your HTML includes attributes remember to escape the double quotes (\") or use single quotes.
thank for the reply, appreciate you taking the time. I did try the above, but unfortunately it didn't work for me. The result was an email body as shown below
"Remote Asset <b>" +source+"</b> (" + me.MachineName + ") has encountered a fault!"
Any ideas where I might have gone wrong?