Newbe:mail binding not working

Hello,

I try to send mail via openHAB but it fails whatever I try. Who can help?

I installed the mail binding and created a thing smtp-server as mentioned in the manual.
Next I made a rule when a mail should be send out.
The action part of the script:
actions:

  • inputs: {}
    id: “2”
    configuration:
    type: application/javascript;version=ECMAScript-2021
    script: >-
    var mailActions = getActions(“mail”,“mail:smtp:e5b47827b7”);

    var success = mailActions.sendMail("xxxxx@xxxxx", "Test subject", "This is the mail content.")
    

    type: script.ScriptAction

But I also tried type: application/javascript

I do get an error in the log:
org.graalvm.polyglot.PolyglotException: ReferenceError: “getActions” is not defined

  • a huge number of lnes and at the end:
    2022-12-16 21:12:41.135 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘Watermeter_lekkage’ failed: org.graalvm.polyglot.PolyglotException: ReferenceError: “getActions” is not defined

When using the updated javascript rules (ECMAScript-2021), the proper method for accessing actions is:

actions.get("mail","mail:smtp:e5b47827b7")

You can find the docs here:

https://openhab.github.io/openhab-js/actions.html

1 Like

Thanks, that worked.

(Running in another problem (will make new topic for it): kaspersky internet security blocks outgoing mail and pushover messages.)