Sendmail not working (2.5.0.M2)


i want to setup mail for notifications including attachments. With the old mail action it was working but after update it isn‘t.

Also after activating legacy addons the mail action is not working.

Then I tried the new mail binding and set up a smtp server thing directly in PaperUI.

After adding the lines of code in the rule it is also not working. „Sendmail is not a member of…“ is The error message in the log.

I tried in the rule with

Val mailActions = getActions...

And without, but everytime the same error. What I have to do to get this running?

See Item 10 especially and give us the FULL log error.


thanks for the answer. You are completely right. For me it’s hard to understand th new documentation about the mail binding. This is the reason why I am asking because I didn’t find anything related in this forum and also on Google.

23:09:58.346 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Test': The name 'sendMail' cannot be resolved to an item or type; line 12, column 2, length 58

This is the error message from the log when I am running the rule. This is my test rule:

rule "Test"
    Item virt_Test received command
    //val mailActions = getActions("mail", "mail:smtp:gmail")
    logInfo("TEST ", "Regel wird geöffnet")
    sendMail("", "Test-Mail OpenHab ", "Huhu ")

I tried with the “val” command and mailActions.sendMail and without.

There was a typo in the address but also no success:
09:10:42.474 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Test’: ‘sendMail’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’; line 10, column 2, length 71

You’ve commented out the line that imports the mailActions.

You need to use mailActions.sendMail(...) to call the action.

1 Like

Yes it is just for testing. Normally this is not out commented

Then I try to send the mail with mailActions.sendMail…both are not working

Please post the Rule exactly is it is written for your latest test. What you have posted can never work. We have no idea what you’ve changed since posting that version.

This binding and action does work. I use it and get an email from it several times a day.

The error you quoted is because you failed to import that actions (commented out) and then tried to call sendMail without going through the imported actions.

In case you missed them, here are the examples from the docs:

val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendMail("", "Test subject", "This is the mail content.")
import java.util.List

val List<String> attachmentUrlList = newArrayList(
val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendHtmlMail("", "Test subject", "<h1>Header</h1>This is the mail content.", attachmentUrlList)
1 Like