openhab-addons: [mail] Unable to send email with an attachment
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.
val String imageUrl = "http://my.openhab.host:8080/static/path/to/image.jpg"
//val String imageUrl = "file:///path/to/another/image.jpg"
//val String imageUrl = "file:///path/to/a/text/file"
//val mailActions = getActions("mail","mail:smtp:gmail")
val mailActions = getActions("mail","mail:smtp:anothermailserver")
mailActions.sendMail("me@somewhere.com", "Email without attachment", "Email content without attachment")
mailActions.sendMail("me@somewhere.com", "Email with attachment", "Email content with attachment", imageUrl)
When viewing the raw source of the second received email, this is what I see.
[snip mail headers]
Subject: Email with attachment
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_7_1653710751.1573740395359"
I’ve installed the OH1 mail action, and I’m able to successfully send an email with an attachment.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 28 (27 by maintainers)
@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…)
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?