aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes IMAP - javax.mail. - Fetching Only Body Without Attachment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "IMAP - javax.mail. - Fetching Only Body Without Attachment" Watch "IMAP - javax.mail. - Fetching Only Body Without Attachment" New topic
Author

IMAP - javax.mail. - Fetching Only Body Without Attachment

Aravind Viswanathan
Greenhorn

Joined: Dec 02, 2008
Posts: 6

Hi,

I am trying to develop an IMAP email client using the javax.mail API. I have been able to contact the servers, fetch emails, attachments and other operations without any problem.

However, we would not want to fetch the attachment until the user wants to view it explit in order to improve the performance. This would mean that we would need information which would indicate if the email has an attachment, if yes, then the filename(s) and the size(s)but would not send me the actual content of the email. However, I was not able to find a method in the API description which would return just the multi-part content.

Is there a way I could fetch just the body and the details of the attachment but not the actual attachment?

Thanks, Aravind
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Attachments are actually part of the entire email body.

An email exists out of two parts: the header and the body. This body can be a "regular" body (in plain text or HTML) but it can also be only an attachment (in base 64 encoding), or a combination of all of these. No client can fetch the email body without attachments because for the server, there is no such thing. The splitting of the body into a human readable form (plain text or HTML) and attachments can only be done when the client has the entire body, including attachments.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IMAP - javax.mail. - Fetching Only Body Without Attachment