Problem with sending email in javascript

Thanks konfetti, that gave me another error but I figured it out. The subject and text need the quote marks around them like this:

var Actions = Java.type("org.openhab.core.model.script.actions.Things");
var mailActions = Actions.getActions("mail","mail:smtp:be93f84a0f");
mailActions.sendMail("me@myemail.com", "subject", "text");

And for people like me who have a hard time with code, note that you can’t enter quote marks into text in a document & then paste it into a code window. Same key on the keyboard but the quote marks from the document are the curly ones instead of the straight ones that you need. Entering them into the script window works.

2 Likes