james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: Facing problems in email parsing using mime4j
Date Tue, 26 Jul 2011 14:54:14 GMT
2011/7/26 Sharma, Ashish <ashish.sharma3@hp.com>:
> Hi,
>
> I am using mime4j for parsing an incoming mail stream and pulling out email body (html
and plain text) and attachments.

What version of mime4j?

> Basically I am creating an 'Email' class that contains 'EmailAttachment' object references.
>
> The 'EmailAttachment' consists of a 'BodyDescriptor' and an 'InputStream', that are populated
by listening to the events generated by a 'ContentHandler'.

You have to make sure you consume the whole inputstream before moving
to the next event, otherwise mime4j will consume it for you in order
to produce the next event.

If you want to parse the full message and access it from memory then
you should better use the dom classes that already provides you with a
message and ignore the low level content handler.

Stefano

> Now the problem that I am facing is that as soon as parsing is over and I pull out 'EmailAttachment'
objects for further processing , the InputStream object does not have the full decoded data
of the original attachment, only a small amount of the original attachment is there.
>
> I am unable to understand where is the data going?
>
> Do I need to use some kind of in memory storage provider?
>
> Thanks
> Ashish Sharma
>

Mime
View raw message