cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Get properties dynamically within email body

SOLVED
Highlighted
Participant

Get properties dynamically within email body

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);

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Get properties dynamically within email body

Just build the string:

"whatever text "+myVariable+" whatever text more "

View solution in original post

8 REPLIES 8
Highlighted

Re: Get properties dynamically within email body

Just build the string:

"whatever text "+myVariable+" whatever text more "

View solution in original post

Highlighted

Re: Get properties dynamically within email body

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">

Highlighted

Re: Get properties dynamically within email body

You have to scape " --> \" or use single quote '

Highlighted

Re: Get properties dynamically within email body

Hi, Sorry I dont completely understand what you are meaning?

Highlighted

Re: Get properties dynamically within email body

var myString = "bla bla bla an embedded string: \"my embbeded string\" bla bla bla "

Re: Get properties dynamically within email body

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>";

Highlighted

Re: Get properties dynamically within email body

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>"; 

Highlighted

Re: Get properties dynamically within email body

Hi Carles

I get a syntax error saying missing before statement?

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!