Closed mhilbush closed 4 years ago
Another person reported the problem on the forum here, noting that it worked in 2.5 M2, and that it stopped working in 2.5 M4.
I reverted the charset change (which is essentially the only change since the binding was merged) and it fails, too. Did it ever work with the new binding?
Did it ever work with the new binding?
I don't recall it ever working.
OTOH, the post I linked to above stated that it worked in 2.5 M2. Frankly, I don't see anything materially different between M2 and M4, other than the charset change you already mentioned. From what I saw, even the javax.mail
and org.apache.commons.mail
lib versions didn't change.
As it works with the OH1 binding, there must be something different...
@J-N-K I installed build 1763, and emails with attachments are working again.
So, in 1750 it's not working. And in 1763, it's working.
What changed???
TTBOMK nothing. There are some reports of problems with sending MIME messages when SAAJ implementations are present, but I don‘t think that applies here.
Yeah, I didn't see any changes that would've had an effect on this. I'm at a loss to explain it.
If it's ok with you, I'll leave this issue open for a little while. I'll keep an eye on things over the next few builds. If it continues to work, I'll close the issue. Ok?
Now I'm really confused...
My production system is running build 1763 with this version of the mail binding. I can send emails with attachments successfully.
255 │ Active │ 80 │ 2.5.0.201911241910 │ org.openhab.binding.mail
My test system is running build 1764 with this version of the mail binding. I cannot send emails with attachments.
226 │ Active │ 80 │ 2.5.0.201911260549 │ org.openhab.binding.mail
The rule code being executed is virtually identical.
val String attachmentUrl = "http://prod.mydomain.com:8080/static/readme.txt"
val mailActions = getActions("mail","mail:smtp:mailserver")
mailActions.sendMail("my.address", "WITH attachment", "Email WITH attachment", attachmentUrl)
val String attachmentUrl = "http://test.mydomain.com:8080/static/readme.txt"
val mailActions = getActions("mail","mail:smtp:mailserver")
mailActions.sendMail("my.address", "WITH attachment", "Email WITH attachment", attachmentUrl)
@J-N-K Do you have any suggestions for what I can look at that might be different?
My production system has A LOT more bindings installed than my test system. Could there be a needed dependency that's not available in my test system?
Can you show a list of the bindings that are installed on the systems?
On the production system: In addons.cfg
package = minimal
# A comma-separated list of bindings to install (e.g. "sonos,knx,zwave")
binding = astro,ambientweather,bigassfan,chromecast,ecobee1,expire1,globalcache,http1,logreader,mail,miio,ntp,serial1,squeezebox,systeminfo,telegram,unifi
# A comma-separated list of UIs to install (e.g. "basic,paper")
ui = paper,basic,habot,habmin,habpanel,restdocs
# A comma-separated list of persistence services to install (e.g. "rrd4j,jpa")
persistence = mysql,rrd4j
# A comma-separated list of actions to install (e.g. "mail,pushover")
action = ecobee
# A comma-separated list of transformation services to install (e.g. "map,jsonpath")
transformation = javascript,jsonpath,map,xpath
# A comma-separated list of voice services to install (e.g. "marytts,freetts")
voice = voicerss
# A comma-separated list of miscellaneous services to install (e.g. "myopenhab")
misc =
In addons directory
-rw-r--r-- 1 mark mark 1975271 Aug 23 14:08 com.goterl.lazycode.lazysodium-java-4.0.1.jar
-rw-r--r-- 1 mark mark 59538 May 9 2019 org.openhab.binding.bhyve-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 2023852 Nov 22 10:34 org.openhab.binding.doorbird-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 21351 Sep 3 2018 org.openhab.binding.sharptv-2.4.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 271445 Nov 20 21:48 org.openhab.binding.somfymylink-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 36596 Jul 2 2018 org.openhab.binding.sunsetwx-2.4.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 230587 Nov 27 07:59 org.openhab.binding.weathercompany-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 3416467 Jan 21 2019 org.openhab.binding.zoneminder-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 2708684 Jun 25 15:02 org.openhab.binding.zwave-2.5.0-SNAPSHOT.jar
-rw-r--r-- 1 mark mark 10512 Sep 24 2017 org.openhab.ui.habpanel.widget.gauge-2.1.0-SNAPSHOT.jar
On test system In addons.cfg
package = minimal
remote = true
# A comma-separated list of bindings to install (e.g. "binding = sonos,knx,zwave")
binding = astro,mail,ntp,serial1
# A comma-separated list of UIs to install (e.g. "ui = basic,paper")
ui = paper,basic,habmin,restdocs
# A comma-separated list of persistence services to install (e.g. "persistence = rrd4j,jpa")
persistence =
# A comma-separated list of actions to install (e.g. "action = mail,pushover")
action =
# A comma-separated list of transformation services to install (e.g. "transformation = map,jsonpath")
transformation =
# A comma-separated list of voice services to install (e.g. "voice = marytts,freetts")
voice =
# A comma-separated list of miscellaneous services to install (e.g. "misc = myopenhab")
misc =
In addons directory
Directory is empty
Not sure if this is helpful, but here's the dependency tree for the mail binding in each of the systems (i.e. the result of bundle:show-tree bundle#
. Is it normal for these to be so different?
Production system
openhab> bundle:tree-show 255
Bundle org.openhab.binding.mail [255] is currently ACTIVE
org.openhab.binding.mail [255]
+- org.apache.servicemix.specs.activation-api-1.1 [68]
+- org.openhab.core [134]
| +- tec.uom.lib.uom-lib-common [202]
| | +- javax.measure.unit-api [31]
| +- org.apache.karaf.services.eventadmin [3]
| | +- org.apache.felix.metatype [2]
| | +- org.apache.felix.configadmin [9]
| | +- org.apache.felix.coordinator [8]
| +- tec.uom.se [203]
| | +- tec.uom.lib.uom-lib-common [202]
| | +- javax.measure.unit-api [31]
| +- com.google.gson [20]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.karaf.services.eventadmin [3]
| +- org.apache.felix.scr [44]
| | +- org.apache.karaf.shell.core [13]
| | | +- org.jline.builtins [15]
| | | | +- org.jline.terminal [17]
| | | | | +- org.fusesource.jansi [5]
| | | | +- org.jline.reader [16]
| | | | +- org.jline.terminal [17]
| | | +- org.apache.karaf.services.eventadmin [3]
| | | +- org.jline.terminal [17]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.ops4j.pax.logging.pax-logging-api [6]
| | | +- org.jline.reader [16]
| | +- org.apache.felix.metatype [2]
| | +- org.apache.felix.configadmin [9]
| | +- org.osgi.util.promise [200]
| | +- org.osgi.util.function [199]
| +- org.apache.commons.lang [43]
| +- javax.measure.unit-api [31]
+- org.openhab.core.automation [263]
| +- org.openhab.core.ephemeris [144]
| | +- org.openhab.core [134]
| | +- jollyday [37]
| | | +- org.threeten.extra [201]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.openhab.core.config.core [139]
| | +- org.openhab.core [134]
| | +- com.google.gson [20]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.commons.lang [43]
| +- org.openhab.core [134]
| +- com.google.gson [20]
| +- org.openhab.core.thing [186]
| | +- org.openhab.core [134]
| | +- org.apache.commons.collections [40]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.felix.scr [44]
| | +- org.apache.commons.lang [43]
| | +- javax.measure.unit-api [31]
| | +- org.openhab.core.io.console [146]
| | | +- org.openhab.core [134]
| | | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.commons.io [42]
| | +- org.openhab.core.config.core [139]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.apache.felix.scr [44]
| +- org.apache.commons.lang [43]
| +- org.openhab.core.io.console [146]
| +- org.openhab.core.config.core [139]
+- org.openhab.core.thing [186]
+- org.ops4j.pax.logging.pax-logging-api [6]
+- org.openhab.core.config.core [139]
Test system
openhab> bundle:tree-show 226
Bundle org.openhab.binding.mail [226] is currently ACTIVE
org.openhab.binding.mail [226]
+- org.openhab.core [134]
| +- tec.uom.lib.uom-lib-common [202]
| | +- javax.measure.unit-api [31]
| +- org.apache.felix.scr [44]
| | +- org.apache.felix.metatype [2]
| | +- org.apache.felix.configadmin [9]
| | | +- org.apache.felix.coordinator [8]
| | +- org.apache.karaf.shell.core [13]
| | | +- org.jline.terminal [17]
| | | | +- org.fusesource.jansi [5]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.jline.reader [16]
| | | | +- org.jline.terminal [17]
| | | +- org.jline.builtins [15]
| | | | +- org.jline.terminal [17]
| | | | +- org.jline.reader [16]
| | | +- org.ops4j.pax.logging.pax-logging-api [6]
| | | | +- org.apache.karaf.services.eventadmin [3]
| | | | +- org.apache.felix.metatype [2]
| | | | +- org.apache.felix.configadmin [9]
| | | +- org.apache.karaf.services.eventadmin [3]
| | +- org.osgi.util.promise [200]
| | +- org.osgi.util.function [199]
| +- tec.uom.se [203]
| | +- tec.uom.lib.uom-lib-common [202]
| | +- javax.measure.unit-api [31]
| +- javax.measure.unit-api [31]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- com.google.gson [20]
| +- org.apache.commons.lang [43]
| +- org.apache.karaf.services.eventadmin [3]
+- org.apache.servicemix.specs.activation-api-1.1 [68]
+- org.openhab.core.config.core [139]
| +- org.openhab.core [134]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- com.google.gson [20]
| +- org.apache.commons.lang [43]
+- org.openhab.core.thing [186]
| +- org.openhab.core [134]
| +- org.apache.commons.collections [40]
| +- org.apache.felix.scr [44]
| +- org.openhab.core.config.core [139]
| +- javax.measure.unit-api [31]
| +- org.openhab.core.io.console [146]
| | +- org.openhab.core [134]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.apache.commons.io [42]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.apache.commons.lang [43]
+- org.ops4j.pax.logging.pax-logging-api [6]
BTW, I'll be away for several hours. If there's something you want me to try, post it here and I'll do it when I get back.
Please try feature:install openhab-core-automation
. Maybe you need to restart after that. That fixes it in my test-system (which showed the error before).
Installed openhab-core-automation
, then restarted. I also installed all the bindings from my production addons.cfg. Still no go. ☹️
247 │ Active │ 80 │ 2.5.0.201911260453 │ org.openhab.core.automation
Ah. I probably know the difference. Can you show bundle:tree-show, then uninstall/install the mail binding and check again? Maybe resolution is cached somehow.
Yes! Uninstalling and installing mail did the trick!
So, what's the issue that causes this?
Before uninstall
org.openhab.binding.mail [226]
+- org.openhab.core.config.core [139]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.karaf.services.eventadmin [3]
| | +- org.apache.felix.metatype [2]
| | +- org.apache.felix.configadmin [9]
| | +- org.apache.felix.coordinator [8]
| +- com.google.gson [20]
| +- org.apache.commons.lang [43]
| +- org.openhab.core [134]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.apache.karaf.services.eventadmin [3]
| +- javax.measure.unit-api [31]
| +- tec.uom.se [203]
| | +- javax.measure.unit-api [31]
| | +- tec.uom.lib.uom-lib-common [202]
| | +- javax.measure.unit-api [31]
| +- org.apache.felix.scr [44]
| | +- org.apache.felix.metatype [2]
| | +- org.apache.karaf.shell.core [13]
| | | +- org.jline.terminal [17]
| | | | +- org.fusesource.jansi [5]
| | | +- org.jline.builtins [15]
| | | | +- org.jline.terminal [17]
| | | | +- org.jline.reader [16]
| | | | +- org.jline.terminal [17]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.ops4j.pax.logging.pax-logging-api [6]
| | | +- org.apache.karaf.services.eventadmin [3]
| | | +- org.jline.reader [16]
| | +- org.apache.felix.configadmin [9]
| | +- org.osgi.util.promise [200]
| | +- org.osgi.util.function [199]
| +- com.google.gson [20]
| +- org.apache.commons.lang [43]
| +- tec.uom.lib.uom-lib-common [202]
+- org.apache.servicemix.specs.activation-api-1.1 [68]
+- org.ops4j.pax.logging.pax-logging-api [6]
+- org.openhab.core [134]
+- org.openhab.core.automation [247]
| +- org.openhab.core.config.core [139]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.openhab.core.ephemeris [144]
| | +- org.openhab.core.config.core [139]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- jollyday [37]
| | | +- org.threeten.extra [201]
| | +- org.openhab.core [134]
| +- org.apache.felix.scr [44]
| +- org.openhab.core.io.console [146]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.openhab.core [134]
| +- com.google.gson [20]
| +- org.apache.commons.lang [43]
| +- org.openhab.core [134]
| +- org.openhab.core.thing [186]
| +- org.openhab.core.config.core [139]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- javax.measure.unit-api [31]
| +- org.apache.felix.scr [44]
| +- org.openhab.core.io.console [146]
| +- org.apache.commons.io [42]
| +- org.apache.commons.lang [43]
| +- org.openhab.core [134]
| +- org.apache.commons.collections [40]
+- org.openhab.core.thing [186]
After install
org.openhab.binding.mail [287]
+- org.openhab.core.automation [247]
| +- org.openhab.core.io.console [146]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | | +- org.apache.karaf.services.eventadmin [3]
| | | +- org.apache.felix.metatype [2]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.apache.felix.coordinator [8]
| | +- org.openhab.core [134]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.felix.scr [44]
| | | +- org.apache.felix.metatype [2]
| | | +- org.osgi.util.promise [200]
| | | | +- org.osgi.util.function [199]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.apache.karaf.shell.core [13]
| | | +- org.jline.terminal [17]
| | | | +- org.fusesource.jansi [5]
| | | +- org.jline.builtins [15]
| | | | +- org.jline.terminal [17]
| | | | +- org.jline.reader [16]
| | | | +- org.jline.terminal [17]
| | | +- org.ops4j.pax.logging.pax-logging-api [6]
| | | +- org.apache.felix.configadmin [9]
| | | +- org.jline.reader [16]
| | | +- org.apache.karaf.services.eventadmin [3]
| | +- tec.uom.lib.uom-lib-common [202]
| | | +- javax.measure.unit-api [31]
| | +- javax.measure.unit-api [31]
| | +- org.apache.karaf.services.eventadmin [3]
| | +- tec.uom.se [203]
| | | +- tec.uom.lib.uom-lib-common [202]
| | | +- javax.measure.unit-api [31]
| | +- org.apache.commons.lang [43]
| | +- com.google.gson [20]
| +- org.openhab.core.config.core [139]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.commons.lang [43]
| | +- org.openhab.core [134]
| | +- com.google.gson [20]
| +- org.ops4j.pax.logging.pax-logging-api [6]
| +- org.apache.felix.scr [44]
| +- org.openhab.core.ephemeris [144]
| | +- jollyday [37]
| | | +- org.threeten.extra [201]
| | +- org.openhab.core.config.core [139]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.openhab.core [134]
| +- org.openhab.core.thing [186]
| | +- org.openhab.core.io.console [146]
| | +- org.openhab.core.config.core [139]
| | +- org.apache.commons.io [42]
| | +- org.ops4j.pax.logging.pax-logging-api [6]
| | +- org.apache.felix.scr [44]
| | +- javax.measure.unit-api [31]
| | +- org.apache.commons.collections [40]
| | +- org.apache.commons.lang [43]
| | +- org.openhab.core [134]
| +- org.apache.commons.lang [43]
| +- org.openhab.core [134]
| +- com.google.gson [20]
+- org.apache.servicemix.specs.activation-api-1.1 [68]
+- org.openhab.core.config.core [139]
+- org.ops4j.pax.logging.pax-logging-api [6]
+- org.openhab.core.thing [186]
+- org.openhab.core [134]
I don’t know exactly. We need the automation part and that is made available by the feature. I don‘t understand why the feature resolution is working without it. But I guess I can force the installation which should fix the issue but I really think it should be discovered automatically.
Ok. What is it about the automation feature that's needed. Sorry for the questions... Just trying to learn.
Also, can't the automation feature be added to the mail binding's feature.xml?
BTW, now I know why it started to work in my prod system. And, it had nothing to do with installing the latest build.
When I was testing with the OH1 binding, I uninstalled the OH2 mail binding. After I finished testing with the OH1 binding, I reinstalled the OH2 binding. That's what fixed it!
Thanks for the help. I NEVER would've figured that out on my own.
We need the automation part and that is made available by the feature. I don‘t understand why the feature resolution is working without it.
The feature resolution works because we do NOT need the automation part. There is no dependency from the mail binding to the new rule engine apart from the reference to the annotations, which is a compile time, but not a runtime dependency.
@J-N-K @kaikreuzer Here's something that hopefully will provide some insight...
First I start with a non-working mail setup:
Sending email with an attachment does not work.
Next I drop the javax.mail version 1.6.2 jar into the addons directory. This is the same javax.mail version specified in the org.openhab.binding.mail pom. Then
Sending email with an attachment now works.
I've not a clue why this is the case. Hopefully you guys know.
The only reference I can find to javax.mail in core is here in org.openhab.core.scheduler, which I see is a dependency of org.openhab.core.automation.
Thanks for your analysis, but this sounds very weird to me - I cannot make any good guess about why it behaves like you describe.
I doubt that it has much to do with the javax.mail
bundle. By default, openHAB contains version 1.4.7 of it:
openhab> list -s -t 0 | grep javax.mail
30 │ Active │ 30 │ 1.4.7 │ javax.mail
and this also does not change at all when installing the new rule engine.
The mail binding packages version 1.6.2 in itself, so it does not do a package import - so whatever you install, it should make no difference.
Btw, where did you get a javax.mail 1.6.2 for the addons folder? The one I found was not OSGiyfied and thus didn't load at all...
I think this is the one I downloaded. I'll double check as soon as I get back to my laptop.
https://mvnrepository.com/artifact/com.sun.mail/javax.mail/1.6.2
I thought the behavior was pretty weird, but I verified it a couple times.
BTW, I don't have any version of javax.mail loaded on my system by default.
BTW, I don't have any version of javax.mail loaded on my system by default.
You do and you will believe me if you type exactly what I did above:
openhab> list -s -t 0 | grep javax.mail
https://mvnrepository.com/artifact/com.sun.mail/javax.mail/1.6.2
That's the one I downloaded as well. Off-Topic: And it seems I found a bug in macOS - when I drag this file to my addons folder, a JPG file from my desktop ends up in addons, which clearly isn't loaded as an OSGi bundle. That's WEIRD - I can do it 20 times in a row and it keeps happening 😲.
You do
Actually, I don't. That's the one I put in addons.
openhab> list -s -t 0 | grep javax.mail
246 │ Active │ 80 │ 1.6.2 │ com.sun.mail.javax.mail
Actually, I don't.
Could you check whether it has been uninstalled through some operation?
I have just downloaded the latest distro 1766, unzipped it, called start.sh
and see:
➜ oh ./start.sh
Launching the openHAB runtime...
__ _____ ____
____ ____ ___ ____ / / / / | / __ )
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
/ /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
/_/ 2.5.0-SNAPSHOT
Build #1766
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab> list -s -t 0 | grep javax.mail
30 │ Active │ 30 │ 1.4.7 │ javax.mail
So it definitely IS there on a fresh installation.
@mhilbush I managed to simplify your description to:
I'd therefore hope that https://github.com/openhab/openhab2-addons/pull/6494 can fix the issue (although I have to admit that I do not understand why, since this package isn't even imported...)
I'm unable to send an email with an attachment using the OH2 mail binding. I'm on build 1750.
When executing the code below, I get two emails. The first email correctly contains the supplied subject and content text. The second email contains the supplied subject text, but no content and no attachment.
I’ve tried this with two different mail servers with the same result.
When viewing the raw source of the second received email, this is what I see.
I've installed the OH1 mail action, and I'm able to successfully send an email with an attachment.