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

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

tcain
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

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

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

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

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

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

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

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

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

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

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

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.