[SOLVED] I having trouble new mail binding

I was used old mail action now i used new mail binding after i update openhab 2.5.0
it showed error and not sent it out
log

2019-12-21 16:16:45.554 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Smoke in House': 'sendMail' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'; line 334, column 2, length 159

thing

Thing mail:smtp:samplesmtp [ hostname="smtp.gmail.com", sender="xxxx@gmail.com", security="TLS", username="xxxxx@gmail.com", password="xxxxx"]

rule

rule "example"
when
Item example changed
then
val mailActions = getActions("mail","mail:smtp:sampleserver")
mailActions.sendMail("xxxx@gmail.com","from openhab","Smoke In House "+ Date1.state.format("%1$tB %1$td, %1$tY %1$tI:%1$tM:%1$tS %1$Tp"))
end

You need to use the same thing-if (i.e. samplesmtp instead of sampleserver).

Hello,
i get the same Error

2019-12-25 23:47:01.146 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Sicherung_Fussbodenheizung’: ‘sendMail’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’; line 8, column 5, length 90

but my names should be ok.

mail_google.things:

Thing mail:smtp:google [ hostname="smtp.gmail.com", sender="myusername@googlemail.com", security="TLS", port=587, username="myusername@googlemail.com", password="mypassword" ]

sicherung.rules

rule "Sicherung_Fussbodenheizung"

when
    Item Sicherung_Fussbodenheizung changed to OFF
then
    logError("Sicherung_Fussbodenheizung", "EVENT ist da!!!!!!!!!!!!!!!!!!!!!!!")
    val mailActions = getActions("mail","mail:smtp:google")
    mailActions.sendMail("myusername@googlemail.com", "Test subject", "This is the mail content.")
end

has thies binding a bug, or is there a config error?

hmmm now it wokrs. Cash clear & Reboot was my solution after 3 Hours…

thank you to Jan N. Klug and Schneider
I did not look at two different and i was following by from Mail - Bindings | openHAB someone need fix that one for openhab mail binding at https://www.openhab.org/addons/bindings

You do know that someone could be you? :wink:

1 Like

Same problem for me. I’m running the released 2.5. I’ve restarted, and uninstalled and reinstalled the binding. Still has the same problem. I tried stopping and clearing the cache and restarting, and it still has the error. Any further suggestions? I defined the thing in the PaperUI. I did a compare with the name in the json file with my rule and it is identical. The file format is utf-8.

The 1.x Mail Action continues to work fine.

Do I have a typo that I can’t see?

Here’s the error in the log:

'sendMail' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'

And here’s the rule:

rule "Battery Status Check"
when
    Time cron "0 0 17 * * ?"
then
    var String msg = ""
    var triggerDevices = gBatteryLevel.members.filter[s|(s.state as Number) <= 40]

    triggerDevices.forEach [ i |
        msg = msg + i.name + ': ' + i.state.toString + '%\n'
    ]

    if (msg != "") {
      sendMail("myemail@gmail.com", "Battery Warning", msg)  // this one works!
      //mail:smtp:db387860
      val mailActions = getActions("mail","mail:smtp:db387860")
      mailActions.sendMail("myemail@gmail.com","Battery Warning", msg)
    }
end

mail versions (is it a problem to have the Mail Action at the same time?):

217 x Active  x  80 x 1.14.0                  x openHAB Mail Action
246 x Active  x  80 x 1.6.2                   x JavaMail API
247 x Active  x  80 x 2.5.0                   x openHAB Add-ons :: Bundles :: Mail Binding

1 Like

Hi jswim788,

Have you tried moving

val mailActions = getActions(“mail”,“mail:smtp:db387860”)Preformatted text

Before

rule “Battery Status Check”

Worked for me…

Algol.

Didn’t work for me. I got thousands and thousands of these errors in the log file once I tried moving that line:

[ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::0.1.0.3::0::/1' failed.
java.lang.NullPointerException: null

Just as a guess I’m trying a things file instead of creating it through PaperUI. I don’t see why that would make any difference, but most users appear to be using the things file.

Please try uninstalling the old action. Since they use different versions of the underlying library this might result in problems

1 Like

Success! Thank you. Although I have to admit I also made the change to a things file. I’m guessing that the real culprit was the old action binding.

Can you explain how to do this?

Depends on how you installed it. If via PaperUI: just click uninstall (probably you have to enable legacy bindings first to see it). If via addons.cfg: delete it from actions=.

Brilliant - that was exactly what the problem was! Uninstalled the old Openhab1 Mail action and rebooted and now working fine.

I tried all remedies I found here and in other topics, but I keep getting the following error:
‘sendMail’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’
My definitions are as follows.

Presence.rules:

rule "PresenceDetection"
when
	Item xyz changed from OFF to ON
then
	val mailActions = getActions("mail","mail:smtp:mailserver")
	mailActions.sendMail("a@b.c", "Testmail", "Testmail")
end

things.things:

Thing mail:smtp:mailserver [ hostname=“192.168.0.27”, sender=“openhab@b.c”, security=“STARTTLS”, username=“openhab2”, password=“[…]” ]

I can’t find the problem. I tried the following:

  • cleared the cache
  • removed the ‘action’ in addons.cfg
  • made sure there was no activated action in PaperUI
  • log:set TRACE org.openhab.binding.mail

Any idea how I can trace the error? Setting the TRACE log on the binding doesn’t generate any additional information, so I’m stuck here.

Restart OH without clearing the cache. That’s what solved the problem with the “sendmail is not a member of error” for me. You must do this every time you clear the cache, or do an upgrade or downgrade of OH (because that process also clears the cache).

1 Like

Restarting OH did it. Thank you very much.

I had the same symptom for a different reason. My mail provider requires TLS and I had forgotten to set the SMTP Server Security Protocol to STARTTLS on the SMTP Server Thing.

1 Like