mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[mail] Fix content processing (#16580)
Signed-off-by: Jan N. Klug <github@klug.nrw> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
a52e5fcf7a
commit
671ef37186
@ -52,6 +52,8 @@ import org.openhab.core.types.Command;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.mail.imap.IMAPInputStream;
|
||||
|
||||
/**
|
||||
* The {@link POP3IMAPHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
@ -184,6 +186,14 @@ public class POP3IMAPHandler extends BaseThingHandler {
|
||||
mimeMultipart.writeTo(os);
|
||||
contentAsString = os.toString();
|
||||
}
|
||||
} else if (rawContent instanceof IMAPInputStream imapInputStream) {
|
||||
logger.trace("Detected IMAPInputStream message");
|
||||
try {
|
||||
contentAsString = new String(imapInputStream.readAllBytes());
|
||||
} catch (IOException e) {
|
||||
logger.warn("Could not read from stream: {}", e.getMessage(), e);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
logger.warn(
|
||||
"Failed to convert mail content from '{}' with subject '{}', to String: {}",
|
||||
|
Loading…
Reference in New Issue
Block a user