Since updating to openHAB 5.1.0, all of my rules that use the Mail Binding are failing. No email is being sent. The error in the log always looks roughly like this:
“Script execution of rule failed: ‘sendHtmlMail’ is not a member of ‘org.openhab.core.thing.binding.ThingActions’”
import java.util.List
rule "eingangsklingel betätigt"
when
Item Eingangsklingelsensor changed from OFF to ON
then
logInfo("KLINGEL","Klingeltaste gedrueckt")
executeCommandLine(Duration.ofSeconds(60), "/etc/openhab/scripts/klingel.sh")
val List<String> attachmentUrlList = newArrayList("file:///webcam/klingel.jpg")
val mailActions = getActions("mail","mail:smtp:a5d5920d8a")
var success = mailActions.sendHtmlMail("mail.sender@mailserver.de",
"Es hat geklingelt",
"<h1>Mitteilung</h1>Es hat um " + now.toString().substring(11,16) + " Uhr an der Haustür geklingelt.",
attachmentUrlList
)
if (success) logInfo("MAIL","Klingel-Mail versandt")
end
Another rule using “.sendlMail” shows naerly the same error in my log. Script execution of rule failed: ‘sendMail’ is not a member of ‘org.openhab.core.thing.binding.ThingActions’
A sudo openhab-cli clean-cache and a restart did not help. What else can I do?
It’s possible this changed, but looking at the docs for the Mail binding, if you are sending an email with attachments there’s a different action to call.
And yet, according to the docs for 5.1, to send attachments you must use sendHtlmMailWithAttachment, not sendHtmlMail.
None of this has changed so I can’t tell you why it worked in 5.0 for you. But according to the docs for both 5.0 and 5.1, you need to use a different action. There is no sendHtmlMail action that takes four arguments.
import java.util.List
rule "eingangsklingel betätigt"
when
Item Eingangsklingelsensor changed from OFF to ON
then
Aussenlampen.sendCommand(ON) //Aussenlampen einschalten
habdisplay.sendCommand(ON) //habdisplay einschalten schaltet automatisch wieder aus
homePageItem.postUpdate("cam_motioneye_vorne") //webcam Haustür als Seite im Habpanel anzeigen
logInfo("KLINGEL","Klingeltaste gedrueckt")
executeCommandLine(Duration.ofSeconds(60), "/etc/openhab/scripts/klingel.sh")
val List<String> attachmentUrlList = newArrayList("file:///webcam/klingel.jpg")
val mailActions = getActions("mail","mail:smtp:a5d5920d8a")
var success = mailActions.sendHtlmMailWithAttachment("x.x@mailserver.de",
"Es hat geklingelt",
"<h1>Mitteilung</h1>Es hat um " + now.toString().substring(11,16) + " Uhr an der Haustür geklingelt.",
attachmentUrlList
)
if (success) logInfo("MAIL","Klingel-Mail versandt")
endode goes here
the log error is:
Script execution of rule with UID ‘eingangsklingel-1’ failed: ‘sendHtlmMailWithAttachment’ is not a member of ‘org.openhab.core.thing.binding.ThingActions’; line 16, column 16, length 250 in eingangsklingel
hmm, copy&paste error, sorry for this, my fault. Next try with .sendHtmlMailWithAttachments ….
import java.util.List
rule "eingangsklingel betaetigt"
when
Item Eingangsklingelsensor changed from OFF to ON
then
Aussenlampen.sendCommand(ON) //Aussenlampen einschalten
habdisplay.sendCommand(ON) //habdisplay einschalten schaltet automatisch wieder aus
homePageItem.postUpdate("cam_motioneye_vorne") //webcam Haustür als Seite im Habpanel anzeigen
logInfo("KLINGEL","Klingeltaste gedrueckt")
executeCommandLine(Duration.ofSeconds(60), "/etc/openhab/scripts/klingel.sh")
val List<String> attachmentUrlList = newArrayList("file:///webcam/klingel.jpg")
val mailActions = getActions("mail","mail:smtp:a5d5920d8a")
var success = mailActions.sendHtmlMailWithAttachments("x.x@mailserver.de",
"Es hat geklingelt",
"<h1>Mitteilung</h1>Es hat um " + now.toString().substring(11,16) + " Uhr an der Haustür geklingelt.",
attachmentUrlList
)
if (success) logInfo("MAIL","Klingel-Mail versandt")
end
with .sendHtmlMailWithAttachments the result is same.
Script execution of rule with UID ‘eingangsklingel-1’ failed: ‘sendHtmlMailWithAttachments’ is not a member of ‘org.openhab.core.thing.binding.ThingActions’; line 16, column 16, length 251 in eingangsklingel
Thank you for the help. The mail binding is now working after a third or fourth sudo reboot now. I still have no idea why multiple reboots were necessary for it to work.
Time
15:00:30.176
Timestamp
Jan 7, 2026, 3:00:30 PM
Level
INFO
Logger Class
org.openhab.core.model.script.MAIL
Message
Klingel-Mail versandt
As this is openHAB 5.1. a new immutable List can be created with the shorter form #["file:///webcam/klingel.jpg"] instead of newArrayList("file:///webcam/klingel.jpg"). See Xtend - Expressions - Collection Literals.
In now.toString().sub… the brackets () can be skipped: now.toString.substring(11,16) — reference Xtend - Expressions - Field Access and Method Invocations.