Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi All
I am trying to send an email (which all works fine) with some basic HTML, but need to call various Thing Properties, how do I go about this:
var myHTML = "<html><head></head><body>\
<h1>Title</h1>\
Content bla bla bla <i>italic</i>\
</body></html>";
var params = {
cc: undefined /* STRING */,
bcc: undefined /* STRING */,
subject: "High Usage Warning" /* STRING */,
from: "87@Litres" /* STRING */,
to: "ssssss@ssss.com/* STRING */,
body: myHTML
}
// no return
Things["EmailServer"].SendMessage(params);
Solved! Go to Solution.
Just build the string:
"whatever text "+myVariable+" whatever text more "
Just build the string:
"whatever text "+myVariable+" whatever text more "
That worked perfectly thanks.
Another thing, how do I insert a big block of html content - i.e. html with pictures and tables etc.
I keep getting syntax errors, even when just trying <img src"http://xxxxxxxxxxxx">
You have to scape " --> \" or use single quote '
Hi, Sorry I dont completely understand what you are meaning?
var myString = "bla bla bla an embedded string: \"my embbeded string\" bla bla bla "
Sorry, I am probably being an idiot, how does that apply to the img src in this code:
var myHTML = "<html><head></head><body>\
<img src="http://www.google.com/test.jpg" alt="netQ Logo">\
<h1>High Water Usage Alert</h1>\
Content bla bla bla "+Things["Ink_1"].Target+" <i>italic</i>\
</body></html>";
var myHTML = "<html><head></head><body>\
<img src=\"http://www.google.com/test.jpg\" alt=\"netQ Logo\">\
<h1>High Water Usage Alert</h1>\
Content bla bla bla "+Things["Ink_1"].Target+" <i>italic</i>\
</body></html>";
Hi Carles
I get a syntax error saying missing before statement?