Loading...

server-user@james.apache.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

RE: Retrieve body of the message Jentu Jain Tue Mar 06 05:00:58 2012

Thanks Loan. I'll try out these options and let you know.

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

Why are major companies rapidly migrating to Passport?  Find Out Here


-----Original Message-----
From: Ioan Eugen Stan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 06, 2012 4:48 PM
To: James Users List
Subject: Re: Retrieve body of the message

2012/3/6 Jentu Jain <[EMAIL PROTECTED]>:
> Thanks Stan.

Hi,

Please call me Ioan, Stan is my family name.

> The method getBodyContent() gives MIME message but I need the parsed MIME 
> message. The message may have say images, attachments, text etc.. I just want 
> to get the text(plain or html) part of the message.
>

Use mime4j to parse the message and get the parts that you need [1].
James does the same if it implements the above mentioned IMAP FETCH command.

Looking at class FetchCommandParser from protocols package I believe James 
supports partial fetch with text see  method addNextElement().

You can find examples of IMAP FETCH commands (with TEXT argument) in the 
mailbox-integration-tester package. Check the scripts at [2], especially the 
ones with Fetch*. They are examples of how an imap session between client and 
server takes place.

I don't know which IMAP FETCH command and args will give you what you need 
(you'll find out in the RFC :) [3] ) but I think it's possible to get what you 
need by sending the appropriate IMAP commands, without implementing your own 
parsing.

If not, please consider adding support for those commands to James.

Regards,

[1] http://james.apache.org/mime4j/usage.html
[2] 
http://svn.apache.org/repos/asf/james/mailbox-integration-tester/trunk/src/main/resources/org/apache/james/imap/
[3] http://tools.ietf.org/html/rfc3501#section-6.4.5
--
Ioan Eugen Stan
http://ieugen.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]