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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Get properties dynamically within email body

Darryl
4-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

Just build the string:

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

View solution in original post

8 REPLIES 8

Just build the string:

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

Darryl
4-Participant
(To:CarlesColl)

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 '

Darryl
4-Participant
(To:CarlesColl)

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

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

Darryl
4-Participant
(To:CarlesColl)

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

Darryl
4-Participant
(To:CarlesColl)

Hi Carles

I get a syntax error saying missing before statement?

Top Tags