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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

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

tcain
1-Visitor

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
7-Bedrock
(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-Visitor
(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
7-Bedrock
(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
14-Alexandrite
(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
12-Amethyst
(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

Announcements


Top Tags