Hi, newbie here trying to understand how to use JS, and in particular, the Mail binding in OH3.1. Here are the steps I took:
- Installed the Mail binding
- Created an SMTP “thing” (not interested in POP and IMAP, just want to send out mail on triggers), entered my Gmail credentials into it.
- Put the following JS in a Rule that is triggered (lifted straight from the Mail binding documentation):
val mailActions = getActions("mail","mail:smtp:mysmtp"); val success = mailActions.sendMail("firstname.lastname@example.org", "Test subject", "This is the mail content.");
The Mail never gets sent, and the openhab.log contains the following error:
2021-08-17 21:49:56.927 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'AllCamsOn' failed: <eval>:1:4 Expected ; but found mailActions val mailActions = getActions("mail","mail:smtp:mysmtp"); ^ in <eval> at line number 1 at column number 4
Since this is on the first line, it is clearly not a missing semicolon, but something else that it must have been expecting in the script header? Some imports maybe? Can someone please give me a pointer, thanks.