New User here — I have OPENHAB running on my RPi 4 and generally the functionality is behaving. However, I have been unable to get email connections to behave. I have added the binding, added SMTP Server item, but try as I may, I am unable to successfully connect email.
I have a light that is configured and operational (for on/off). I have attempted to add a rule to send a notification when the status changes from On to Off (also tried the other way). The logs indicate the rule has triggered, but I get this message:
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘c7156a0a16’ failed: var notifications = ___ Java.type(‘org.openhab.io.openhabcloud.NotificationAction’);
The thing shows a status of online.
This is the rule that raises the aforementioned error.:
** notifications.sendNotification(‘adena@moretrees.world’,‘This is a test’);**
** type: script.ScriptAction**
I am sure that I have something misconfigured, but I haven’t found a good set of (beginner) instructions to properly configure it and/or properly trigger it. Any advise is greatly appreciated.
sendNotification is not sending a SMTP email. It is about pushing a notification via the app.
To send an email you need to use one of these actions: Mail - Bindings | openHAB that are made available via the mail binding.
Clearly, I am off track. I created the SMTP binding, it shows online, but no channels.
I am now trying to call it, but whenever I find examples to mimic, none of them work. If somebody can get me started, I am sure i can figure out where I have gone sideways.
The email server is on the same box (it is a citadel server). The email does work, I have tested SMTP. I can send email from other computers using the smtp configuration.
I did set up several items (again, found samples online). These make no sense to me at this point…so I do not know if they are correct or another red herring.
I tried several methods of scripts/rules but none of them behave. Blockly offers a “send email notification”, I have also tried JS.
Current Error:
2022-01-23 16:00:09.864 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘c7156a0a16’ failed: :1:11 Expected ; but found statusString
var String statusString = “Light turned on”
^ in at line number 1 at column number 11
Code:
var String statusString = “Light turned on”
val eventTime = triggeringItem.lastUpdate(“Floor Light”)
val mailActions = getActions(“mail”,“mail:smtp:0d5ea03e0a”)
Progress!
I am now getting this error message:
==> /var/log/openhab/openhab.log <==
2022-01-23 16:39:08.936 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : moretrees.world:587
2022-01-23 16:39:08.937 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: Could not convert socket to TLS;
I am confused because I have my SMTP Server set for STARTTLS, compared the settings to an SMTP connection that is working and found no difference. Please advise…
Do you have an SMTP server such as: ssmtp installed on your Raspberry Pi? This link is for ssmtp which I have used for a while. Apparently it is no longer maintained but the link shows other options. It will do the forwarding to your email server.
I do not have a SSMTP server, but I do have a SMTP server installed (and operational). If I use SSMTP, do I need to create another THING for it, or how do I point at this alternate method?
When I linked Thunderbird mail client and hooked it to my RPi email server, I did need to add a certificate exception (or something to that effect) before it would connect. Could I be running into the same thing…and if so, how would I go about addressing it?