Email template for email to sms service
-
Hi guys
I need some advice on setting up an email template that will be sent to a email to sms service provider. The system consists of the following.
There are 50 remote sewerage site that have a sump and 2 pumps.
There is a discrete point for the trip/healthy signal so I will set an on change event for this as it is helpful to know if the pump goes back to healthy.
There is a ultra sonic sump level that will need a high and high-high event handler
I am quite comfortable with getting all this setup and did a test email event handler today.The email to sms provider has indicated that I will need to send the email to them with the destination cellphone number as the subject, there will be about 5 numbers comma separated. I have not figured out how to approach this and will need some help due to the little time available.
The email will need to consist of :
To: serviceprovider.com
Sugbject : 0841231111,0841231133 ( cell phone number)
Body : "site name" - "device name" - "point name"-"point value"
eg: Margate- Pump 1 - Condition - Trip/Healthy
or
Margate - Sump - level 90%Id also like a little advice on how to structure the data point naming. So that these values can be dynamically inserted into the email body and not have the need to make a template per remote site. our radio network topology is a star and all the remote nodes data gets organised on a central PLC which will be a modbus TCP data source. My initial thought would be to structure it as follows even tho all the data sources will all have the same IP:
Data source = site name
Device name = pump 1
point name = condition
point value = trip/healthyData source = site name
Device name = Sump
point name = Level
point value = 90%Thanks in advance for any help...
-
Here is a post from Phillip that has useful information in it. https://forum.infiniteautomation.com/topic/2867/email-title-format/3
For your exact format here are the steps to get it working.
- On systems setting under email settings, make sure you have the email format set to HTML and Text
On your email event handler use this as the custom template:
<@subject>0841231111,0841231133</@subject> <#if renderedHtmlPointValues??> <#list renderedPointValues as renderedPvt> ${point.dataSourceName} - ${point.deviceName} - ${point.name} - ${renderedPvt.value} - ${renderedPvt.time} </#list> </#if>
You can remove the - ${renderedPvt.time} if you don't want the time stamp.Also, change the: Include previous point values for point events to 1 on the email handler.
Your email should look like this.
-
Thanks Joel
I did a quick test and the mail is as expected just need to do a test now with the service provider but I am quite confident it will work...
-
Re: Email template for email to sms service
Hi Joel,
I need add ID (Date.now) in my subject for send SMS:
<@subject>user_login=naiobeexxxxxx&api_key=xxxxxxxxxxOuajh1s2Oy&sms_type=FR&sms_sender=NAIoBEE1&transactional=1&request_id=1234&sms_recipients=00336xxxxxxx<@subject>
What i can to make for change request_id automatically with Date.now for javascript.
Thanks
-
Hi Frank,
You are providing a custom FTL template for an email event handler, correct?
FreeMarker Template Language has some built-in functions and special variables that would help you to achieve this, specifically the
.now
special variable.See here for how to transform that into human readable strings if necessary: https://freemarker.apache.org/docs/ref_builtins_date.html
See here for a list of special variables in FTL: https://freemarker.apache.org/docs/ref_specvar.html