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?
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.