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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How do I reference the mail server in order to send out alerts

tcain
1-Newbie

How do I reference the mail server in order to send out alerts

I have gotten the mail server to send out a test email successfully. Now I need to build some logic that will  send out an email alert if an input goes over a certain value. I am just not sure how to reference the Mail Server.

Thanks,

Toby

5 REPLIES 5
ds-21
1-Newbie
(To:tcain)

Hi Tobias,

              In mailServer template has sendMessage service. you can use that service in your Thing or template (i.e sampleMailThing).

if(me.temp>40)

{

   

var params = {

  cc: undefined /* STRING */,

  bcc: undefined /* STRING */,

  subject: undefined /* STRING */,

  from: undefined /* STRING */,

  to: undefined /* STRING */,

  body: undefined /* HTML */

};

me.SendMessage(params);

}

or

You use subscription to achieve this

1) create new subscription

2) choose event as data chage.

3) choose the desired property.
4) check the Enable check box

tcain
1-Newbie
(To:ds-21)

Thank you for the help! I got that to work creating a property in the MailService it self, but I was hoping to pull a property that I am reading from API to compare to. Should I re-read the API in order to get that property or is there a way to pull those values in from a different Thing.

Thank you,

Toby

ds-21
1-Newbie
(To:tcain)

Hi Tobias,

    if your API values are stored in Property. you should do one thing, instead of me.temp(in above solution).use var value = Things["ThingName"].PropertyName .This will get the value of the another thing property value.

​I hope this help helpful.

Thanks

Dinesh

ttielebein
12-Amethyst
(To:tcain)

Hey, you may want to consider marking one of these answers as correct if it helped you so that others can find the solution as well

ankigupta
5-Regular Member
(To:tcain)

Hi Tobias Cain​,

You can use subscription for that. To reference the mail server; go to entities tab in your subscription and select the mail entity and then the service. You can insert the corresponding javascript code by using the arrow key.

I hope it helps.

Thanks,

Ankit Gupta

Top Tags