Pe 23.02.2012 09:00, Jentu Jain a scris:
Hi,
I want to persist the emails that are moved to IMAP mailbox to another 
application's database as a file. What should be the format of the file that 
would hold the message so that it can be saved/retrieved to/from the 
application?

Regards
------------------------------------
Jentu Jain | Datacert, Inc.

Why are major companies rapidly migrating to Passport?  Find Out 
Here<http://www.datacert.com/>
[Description: 
cid:[email protected]]<http://www.datacert.com/feed.xml>[Description: 
cid:[email protected]]<http://twitter.com/datacert>



Hi Jentu,

I think the best way to save the message is in it' original form, as a standard Internet message format (http://tools.ietf.org/html/rfc2822). You can get the original stream of bytes (Message object has a getContent method and getBody() that provide InputStream's) and you can persist them.

You can then use mime4j to parse the message and get the parts that you wish. Either dynamic, on request, or save offsets for each part of the message (the message does not change). Depends on your needs but the first should be all you need.

Cheers,

--
Ioan Eugen Stan
http://ieugen.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to