Stefano,

I am using mime4j 0.6.1, Right now I am using the 'StorageProvider' interface 
to consume the whole inputstream via the ContentHandler event api of mime4j.

Please reply your comments on this.

Thanks
Ashish

-----Original Message-----
From: Stefano Bagnara [mailto:[email protected]] 
Sent: Tuesday, July 26, 2011 8:24 PM
To: [email protected]
Subject: Re: Facing problems in email parsing using mime4j

2011/7/26 Sharma, Ashish <[email protected]>:
> 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
>

Reply via email to