Handle IMAPInputStream in getMessage to prevent ClassCastException

FixEmailService
Ya
26 Aprili 2026, 04:19 UTC
Mwandishi
Kamo
Ahadi ya
5616354

JavaMail can return an IMAPInputStream instead of a decoded String from part.getContent() when message content has not been pre-fetched. The direct (String) casts in parseMultipart() threw ClassCastException for affected messages, causing fetchFullMessage to fail before mark-as-read was called, so emails never got marked read in classic mode. Add partContentAsString() helper that checks instanceof String first, then falls back to reading an InputStream with the part's charset. Add extractCharset() to parse charset from Content-Type header. Update parseMultipart() to use the helper for all text/* body parts. Also add InputStream branch to top-level getMessage() body parsing for single-part messages whose content arrives as a raw stream.

Mabadiliko yote

Je, unaona nini kuhusu usafiri?

Kila moja ya hizi updates ardhi katika nafasi yako ya kazi moja kwa moja. Kuanza bure na kuangalia kukua wiki baada ya wiki.

Kuwa Huru MileleMtazamo wa bei