Bulk mail body extracts using the Javamail API and IMAP

Is there a way to retrieve the mail bodies of multiple emails with a single call to an IMAP server using the Javamail API?

I know that I can get to the body of this message using the Message.getContent () call, but this completes the imap server call for each individual message.

Can FetchProfile and Folder.fetch calls be used for bulk extraction bodies? The documentation assumes that FetchProfile is for header data only. I tried the following, but that did not help:

FetchProfile fp = new FetchProfile(); fp.add("rfc822.text"); inbox.fetch(messages, fp); 

If this cannot be done using Javamail, is it due to a restriction in the Javamail API, or does IMAP simply not support it?

+4
source share
1 answer

JavaMail restriction. IMAP allows you to immediately receive the bodies of several messages:

 a1 fetch 1:* (rfc822.header rfc822.text) 

This page is a good introduction to learning IMAP through telnet: http://bobpeers.com/technical/telnet_imap

+2
source

All Articles