Sendmail not working (2.5.0.M2)


  1. JSONDB is backed up automatically on every change and periodically. See $OH_USERDATA/jsondb/backups (e.g. /var/lib/openhab2/jsondb/backups).
  2. Running openhab-cli backup/restore also backs up the contents of the JSONDB.
  3. Any manual backup procedure you have must include parts of $OH_USERDATA anyway or else it is an incomplete backup. At a minimum it needs to include jsondb, and binding specific directory (e.g. zwave, mqtt), and persistence. If not it is only a partial backup.
  4. Because the JSONDB is text based, you can even easily check it into git or your source control of choice and see diffs and stuff like that.

If you are manually backing up OH and not including folders like JSONDB from $OH_USERDATA, even if you don’t use PaperUI for anything, your backup is only a partial backup. If you are using openhab-cli to backup, then you are already backing up the jsondb. And if all you need to back up is the jsondb, well that’s handled for you.

I had the same issue, that my getActions() returned null.
I renamed the thing and adapted the rule, and then it worked.
So could be a workaround if someone is facing an issue.

I had the same issue, and a restart fixed it (but I will get the warning noted above).

I have the same issue since upgrading from 2.5.0 S1776 to 2.5.0 (general release)

I have tried:

  • restarting openhab
  • stopping openhab, clearing the cache, starting openhab
  • deleting my smtp server thing and recreating it
  • uninstalling the binding, restarting openhab, and reinstalling the binding
  • backing up with openhab-cli, purging openhab with apt, installing openhab, restoring backup

my rule

val mailActions = getActions("mail","mail:smtp:989680e0")

rule "Garage door lock status updates"
        Item Door_Lock_Alarm changed
        switch(transform("JSONPATH", "$.type", Door_Lock_Alarm.state.toString)) {
                case "17", case "23", case "26" : mailActions.sendMail("", "Door lock jammed", "Front Door lock jammed")
                case "18", case "21", case "24", case "27" : Door_Lock.postUpdate(ON)
                case "19" : {
                        val userID = transform("JSONPATH", "$.value", Door_Lock_Alarm.state.toString)
                        var userName = ""
                        switch(userID) {
                                case "1": userName = "Bill"
                                case "2": userName = "Ted"
                                default: userName = "Unknown"
                        mailActions.sendMail("", "Door lock opened by code", "Door lock opened by " + userID + " " + userName)
                case "22", case "25" : Door_Lock.postUpdate(OFF)
                case "161" : mailActions.sendMail("", "Door lock bad code attempt", "Someone entered a bad code at the front door lock")
                case "167" : {
                        if(Door_Lock_Battery_Timer.state.toString <> "ON") {
                                mailActions.sendMail("", "Door Lock Battery Low", "Low battery in the front door lock")

the error

2019-12-15 22:07:16.121 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Garage door lock status updates': 'sendMail' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'; line 18, column 25, length 120

stupid question, but have you tried rebooting?

1 Like

Because you are “grabbing” the action to a global reference outside of your rule, it needs to be available at the moment the rules file is parsed. If it isn’t, there is no recovery.

We know openHAB files load sequence is umm a bit iffy.

I would restructure to improve your chances.

 rule "Garage door lock status updates"
     val mailActions = getActions("mail","mail:smtp:989680e0")

Thanks both of you for your suggestions, I really appreciate it.

@rossko57 , your idea worked. It used to work when I declared it globally in the past, but maybe between S1776 and the release something changed in the way rules are loaded. I’ve also added rules, so maybe having more rules to load caused this issue and it was unrelated to the version change.

I have the same problem.

Restarting and cleaning the cache did not work.
I defined the mail thing in the .things file.

Could we recover by running a touch *.rules in the rules folder (assuming they are manually created)?

Updating to the stable release 2.5.3 should be the first step. Nobody should be running 2.5M2, the subject of this thread…

I suggest you restart openHAB without another cleared cache after the restart and clear the cache. (Yes, another restart after the first one.) I have to do this every time after any version upgrade to get sendmail to work. Yes, I almost always forget to do this, then sendmail fails (also killing the rest of the rule execution so something doesn’t work), then I notice it, then I restart openHAB and it starts working again.

1 Like

I’ll give this a try, I just updated to 2.5.3-1 the other day and it seems my sendMail is not working. I cleared cache, rebooted, and have now removed & readded the binding as well as my SMTP server. I’ll reboot again as I still get the error:
‘sendMail’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’
whenever a rule triggers a send. I’ll also try reordering the val under the “then” statement in all of my rules.

That’s exactly the error I get until I either restart or reboot again.

Yep, it just started working again after another reboot.

When I removed the binding, my OH web interface went sideways and required a restart then too. It is back and working again. I created the mail server thing via PaperUI this time too.

Not sure what triggered this to start failing, it was working a few days ago but I only have email rules trigger every now and then. The last one was before my OH update from 2.5.3 -> 2.5.3-1 but that may have been a coincidence.

Possibly the clear cache causes this problem. Upgrades do a clear cache in the background. That’s my theory. Could be wrong. But a 2nd restart always seems to fix it for me.

That means you should start a new thread then. The version is different and the solutions here did not work for you. It is a different problem.

Nasty bug…

1 Like

Thank you very much for this reply. Rebooting after the clear cache did the trick for me in version 2.5.5 as well.

Just before I thought I was going insane :slight_smile:

1 Like

I received the ‘sendMail’ is not a member … error. I’m on 2.5.8, but I’m adding this comment because I found this thread when I searched for the error.

Based on the suggestions in this thread, I rebooted (sudo reboot) my Pi 4, which resolved the problem for me.

Reboot works, but probably all you need to do is restart the openHAB 2 service.