Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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
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
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
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
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
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