I am no longer able to send email from rules (I used to before I did a reinstall of openHAB about a month ago). The error I get is:
2020-05-20 11:17:56.739 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘notification test’: The name ‘mailActions’ cannot be resolved to an item or type; line 7, column 1, length 11
I have the MailBinding installed, and I set up both a cfg file and a thing.
mail.cfg
hostname=smtp.gmail.com port=587 username=myemail@gmail.com password=mypassword from=myemail@gmail.com tls=true ssl=false
mail.things
Thing mail:smtp:testmail [ hostname=“smtp.gmail.com”, sender="myemail@gmail.com", security=“TLS”, port=587, username="myemail@gmail.com", password=“mypassword” ]
And this is the rule
rule “notification test”
when
Item jack changed
then
val mailActions = getActions(“mail”,“mail:smtp:samplesmtp”)
if (jack.state == ON) {
logInfo(“notifications”, “Sending notification via app.”)
mailActions.sendMail(“myemail@gmail.com”, “Test”,
“This is our notification sent via app.”)
sendNotification(“myemail@gmail.com”,
“This is our notification sent via app.”)jack.postUpdate(OFF)
}
end
sendNotification works by itself but sendMail doesn’t work.
I’ve read through similar messages on the forum but can’t get this to work.
Mike