This is the last configuration but I have also tested ports 465 and 587 and SSL/TLS security
If I run bundles:list I see the mail binding, so it seems to be active
I have read many threads with mail issues but they all seem to be related to either the smtp configuration or the syntax in the script which seem to be correct in my case
Can anyone guide me as to how to troubleshoot this issue?
Thank you
Carlos
Platform information:
Hardware: Windows 11
openHAB version: 3.2
Please post configurations (if applicable):
Items configuration related to the issue
Sitemap configuration related to the issue
Rules code related to the issue
Services configuration related to the issue
If logs where generated please post these here using code fences:
with port 587
20:35:30.455 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: Could not connect to SMTP host: smtp.comcast.net, port: 587;
nested exception is:
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
or
with port 465
20:36:59.961 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.comcast.net:465
20:36:59.962 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
with port 465 and STARTTLS
20:40:00.142 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.comcast.net:465
20:40:00.144 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketTimeoutException: Read timed out
This is what xfinity says are the smtp settings
Outgoing Mail Server Name: smtp.comcast.net
Outgoing Mail Server Port Number: 587 (SMTP)
If Needed: 465 (SMTPS)
Encryption: TLS (use SSL if TLS isn't shown.)
Authentication: Type in your Comcast.net email address
Not sure what else to try
Thanks again but I just cannot get this to work. Either with Comcast or Google
I simplified the script
val mailActions = getActions(“mail”,“mail:smtp:dd7055cab0”)
mailActions.sendMail(“xxx@yahoo.com”,“openhab”,“Test”)
With port 587 and STARTTLS I get
17:30:03.782 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.gmail.com:587
17:30:03.783 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
Same thing with port 465 and SSL/TSL
17:33:26.085 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.gmail.com:465
17:33:26.086 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
I’ve just tested it using gmail. At first I got an NPE because in my text configuration for the things, I had port=587 (presumed that it was an integer).
When I changed the port to string i.e. port="587" it worked.
Thank you for doing all these trials but it did not work for me
If I use the “587” as the port in the UI, the code shows port: ’ “587” ’ but the binding ignores it and send the default port (25) which times out.
Here is my thing code entering 587 (no quotes) in the UI
val mailActions = getActions("mail","mail:smtp:dd7055cab0")
mailActions.sendMail("xxx@yahoo.com","openhab","Test")
and the error
21:53:52.287 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.gmail.com:587
21:53:52.289 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
If I remove the quotes in the code (port: 587), then the binding thinks it is a real number and sends 587.0 as the port which gives many errors
The quotes are only applicable for file based configuration. For UI based, enter it in the UI without quotes, and in the “Code” tab you’ll see it with quotes.
I couldn’t recreate the same errors that you had with jruby, but when I tried creating a GUI script using RulesDSL, I can see the exact same error!
I see the same behavior described in that discussion. The mail is sent if the script is triggered by the rule. If I click on run on the script itself then I get the error. At least now it works, it is just difficult to test new scripts.