I have a javascript script being called by the HTTP binding. While calculating a return value works in the script, integrating a sendMail() value doesn’t. It throws an error in the HTTP binding like this: ab.binding.http.internal.HttpBinding] - Transformation 'JS(testEvent.js)' threw an exception. [response=...]
The sendMail() configuration seems to work, although I never sent a mail through openhab, but at least it doesn’t throw an error when mail.cfg is read.
The script I am trying to use is:
(function(i) {
var json = JSON.parse(i);
sendMail("a@b.c", "Testsubject", "Testcontent");
return ((json['state'])) == true ? "ON" : "OFF";
})(input)
Do I have to include a library at the beginning of the javascript, or anything else to be able to access sendMail()?