Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mail] email not being sent it using sendHtmlMailWithAttachments option #15482

Closed
ubeaut opened this issue Aug 23, 2023 · 1 comment · Fixed by #16587
Closed

[Mail] email not being sent it using sendHtmlMailWithAttachments option #15482

ubeaut opened this issue Aug 23, 2023 · 1 comment · Fixed by #16587
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@ubeaut
Copy link

ubeaut commented Aug 23, 2023

Expected Behavior

Email should send with attachments and be in HTML format.
If I use sendHtmlMail option the mail is sent and is in HTML format.

Current Behavior

Email send a warning to the log and email is not sent.
[2023-08-22 19:00:14.706 [WARN ] [ab.binding.mail.internal.SMTPHandler] - javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: text/plain; charset=UTF-8

Possible Solution

Currently I just send the email and attachments and use plain text.

Steps to Reproduce (for Bugs)

This doesn't work:

var message = "<H2>Someone is at the front gate at " + Date() + "</H2>";
var attachmentUrlList = ["http://192.168.1.164/zm/cgi-bin/zms?mode=single&monitor=1&scale=50",
                         "http://192.168.1.164:8080/static/graphviz.png"];

actions.get("mail", "mail:smtp:a514b96247").sendHtmlMailWithAttachments("xxxxxxx@gmail.com", "openHAB 4 front gate IR", message, attachmentUrlList);

This works:

var message = "<H2>Someone is at the front gate at " + Date() + "</H2>";
var attachmentUrlList = ["http://192.168.1.164/zm/cgi-bin/zms?mode=single&monitor=1&scale=50",
                         "http://192.168.1.164:8080/static/graphviz.png"];

actions.get("mail", "mail:smtp:a514b96247").sendMailWithAttachments("xxxxxxx@gmail.com", "openHAB 4 front gate IR", message, attachmentUrlList);

Context

I have mentioned it in the forum here:
https://community.openhab.org/t/oh4-sending-email-as-html-with-attachent-javascript-not-dsl/148951

Your Environment

  • Version used: (e.g., openHAB and add-on versions) OH4.0.2
  • Environment name and version (e.g. Chrome 76, Java 8, Node.js 12.9, ...):
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, ...):

Operating system Linux/6.1.0-11-amd64 (amd64)
Java Runtime Azul Systems, Inc. 17.0.7 (Zulu17.42+19-CA)

@ubeaut ubeaut added the bug An unexpected problem or unintended behavior of an add-on label Aug 23, 2023
@OmegaQuest
Copy link

I also get this same exact error but only when trying to send via: sendHtmlMailWithAttachment

sendHtmlMail works fine and so does sendMailWithAttachment just not the "Html" option with Attachment

OpenHAB v 4.2.0 M1
17.0.10 (Zulu17.48+15-CA)
Ubuntu 22.04.4 LTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants