This is on the latest 3.2 released (the first 3.3 snapshot actually but close enough).
I’ve migrated my rules to JSScripting and I think based on what I’ve seen this is only a problem in JSScripting.
When I attempt to send simple text email using the Action I get the following error and no email is sent:
021-12-20 14:42:15.581 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.gmail.com:587
2021-12-20 14:42:15.581 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
When I try to send the same message as HTML:
2021-12-20 14:40:32.423 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.gmail.com:587
20│2021-12-20 14:40:32.424 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: multipart/alternative;
boundary="----=_Part_21_1035614427.1640036431905"
Is anyone experiencing this same error in other languages or is it just JSScripting?
Hi @rlkoshak per the other thread, I too am having this issue. I am also using the JavaScript, but it seems to be broken both with the original version of JavaScript (application/javascript) and the new (application/javascript;version=ECMAScript-2021). It was working in 3.1 until I upgraded to 3.2. I have not yet tried DSL or other languages yet.
Here are the details I posted from the other thread:
Anyone else having a problem with their Mail binding after the upgrade? I’m getting:
14:49:46.473 [WARN ] [hab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : redacted.redacted.net:25
14:49:46.476 [WARN ] [hab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8
Actual addresses / IDs redacted. This was working in 3.1 on a manual install at /opt/openhab. It broke after running the upgrade script. I tried a fresh install to see if that made a difference but same problem on a fresh install too.
OK, I’ll remove that part of the title of the thread so it’s clear that this is a more general problem.
I kind of borked my upgrade to JSScripting (it’s all OK now) so IO wasn’t sure if this was a problem or not.
It would be great is someone can report whether or not it’s broken in Rules DSL too. I suspect it’s a universal problem though if it’s broken in both Nashorn and JSScripting.
I am on 3.2.0 Release Build. All rules still implemented in Rules DSL. Mail works fine, just tested it with a flood seensor.
Thing is set up in the GUI, using STARTTLS for encryption. The rule code is this:
rule "Reagiere auf Überflutung im Bad"
when
Item Bad_Flutsensor_Flut changed from OFF to ON
then
if (Logging.state == ON) { logInfo("default","##### Flutsensor meldet Wasser: " + Bad_Flutsensor_Flut.state) }
postUpdate(Bad_Flutsensor_Flut_Anzeige, ON)
val message = "Flutsensor meldet Wasser auf dem Boden\n\nManuelles Zurücksetzen des Alarms nicht vergessen!\n\nGreets,\nopenHab"
val mailActions = getActions("mail","mail:smtp:xxxxxx")
mailActions.sendMail("redacted@redacted.domain", "ACHTUNG: Wasseralarm", message)
end
OK, so there definitely is something wrong and perhaps it’s only broken in UI rules. In any case I think we have enough info here to file an issue. Thanks!
I have something here that is probably related, but I can’t fully explain it. My dsl-rules based notification where working fine with OH 3.2 release till this morning.
Today I started trying to build JavaScript based rule turning out in error message described in this thread here.
Since that also my DSL-based rules fail to work
While I have set the debug of javax.mail to Trace I found out that following is written in openhab.log
2022-01-02 13:27:26.597 [WARN ] [rnal.service.RemoteControllerService] - Cannot open remote interface (Unknown response received for access query)
2022-01-02 17:52:42.571 [INFO ] [rnal.service.RemoteControllerService] - Using Legacy interface
2022-01-02 17:59:39.679 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.strato.de:465
2022-01-02 17:59:39.682 [WARN ] [ab.binding.mail.internal.SMTPHandler] - java.util.ServiceConfigurationError: javax.mail.Provider: com.sun.mail.imap.IMAPProvider not a subtype
2022-01-03 07:07:00.905 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.strato.de:465
2022-01-03 07:07:00.930 [WARN ] [ab.binding.mail.internal.SMTPHandler] - java.util.ServiceConfigurationError: javax.mail.Provider: com.sun.mail.imap.IMAPProvider not a subtype
when triggered
==> /var/log/openhab/openhab.log <==
2022-01-03 09:49:22.096 [WARN ] [ab.binding.mail.internal.SMTPHandler] - Sending the email to the following server failed : smtp.strato.de:465
2022-01-03 09:49:22.107 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: multipart/alternative;
boundary="----=_Part_44_9220965.1641199761607"
Getting the same error with new javascript rules as the one in the post by rikoshak at the top. Strangely it seems to be an intermittent problem for me.
As I already said a month ago: this is an issue with classloading. There is nothing a user can do to fix it. It either requires changes in core or in the binding.