Email rule driving failing with various errors

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2
    • OS: Raspbian GNU/Linux 10 (buster)
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: openHAB 2.5.10-1 (Release Build)

Hi,

I had a simple rule that sends out an email of presence when the mobile is pinged. I’ve just started experimenting with rule. It was working for a couple of days until I did an update this morning.

presence.rules

 val mailActions = getActions("mail","mail:smtp:samplesmtp")
 rule "EmailPinku"
    when
Item Presence_Mobile_pinku changed from OFF to ON
    then
mailActions.sendMail("pinku@pinku.mynetwork.home", "Pinku is home", "This email is to let you know that Pinku is about")
end

mail.things

Thing mail:smtp:samplesmtp [ hostname="pinku.mynetwork.home", sender="openhab2@mynetwork.home", security="PLAIN", username="pinku" ]

I read in the forum that the above mailActions needs a services/mail.cfg file but then I also read that mailActions is deprecated in OH2.5.1 so I’m really lost now.

Since the update this morning I get this error in the logs:

020-12-05 12:46:53.488 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'EmailPinku': 'sendMail' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'; line 6, column 3, length 125

What is this actually telling me? Its as if the update caused an update of the syntax rules and now it doesn’t recognise my rule anymore. In fact, I’m not getting the emails since the update.

Any thoughts?

Can you confirm that the Mail Binding is installed?

Have you tried restarting after the update? Perhaps more than once?

It is installed. As I said, the rule was successfully working prior to the update this morning. Have run sudo systemctl stop openhab2 and sudo systemctl start openhab2 and cleared the cache once too. Any other ideas?

You upgraded to 2.5.10? What version of OH were you using before the upgrade?

What do you get when executing this in the console?

list -s | grep mail

[02:41:46] openhabian@pinku:~$ list -s | grep mail
-bash: list: command not found

Strangely enough, after yet another restart of openhab2, it started working again. Bit temperamental this OpenHab2 …

OH requires at least two restarts after clearing the cache. The cache is cleared after an update.

The console.

Ahh, … I thought the console was a straight ssh login to port 22 :slight_smile:

openhab> list -s | grep mail
207 │ Active │ 80 │ 1.6.2 │ com.sun.mail.javax.mail
233 │ Active │ 80 │ 2.5.10 │ org.openhab.binding.mail

The binding is definitely installed, but you were likely being effected by this bug…

Seems like the bug hasn’t been resolved. More importantly, I stopped receiving emails since yesterday without having done anything on the OpenHAB server (the Pi3). Hopefully, it’ll get resolved soon.

This issue is marked as resolved. If you are sure that this is the same problem, you should open a new issue in GH and reference the other one.