You can use fetch bodystructure, it should contain all information such as attachment names etc. and then there is SNIPPET support also in 2.2.36, which lets you fetch a 100 character snippet of the mail.
Aki
On 15.11.2018 11.57, Alessio Cecchi wrote:
Hello,
we are developing a web page, for a ticket system, to show the email messages ordered by the biggest attachments size present in an IMAP folder, with a pagination of 100 messages per page. Each raw represents a message with "DATE, FROM, SUBJECT, the preview (the first 500 chars of the text/html of the messsage) and the list of the attachments (name + size) it contains.
The problem is that the page load is VERY slow because we fetch the entire BODY of all 100 messages, in order to get the preview and the attachments name and size.
Now, considering that each messages can contain up to 50 MB of attachments, we risk to download 5000MB from IMAP for every page.
An option might be to perform two FETCH for each message:
one fetch with just the BODYSTRUCTURE (where we can get the attachments name and size and the text/html parts).
one fetch with the body parts (BODY.PEEK[]) we need to build the preview (text + html).
We are wondering if there is a single FETCH command to get the text and html parts (needed to build the preview) with only the name and the size of the attachments without downloading the entire message.
Thanks.
-- Alessio Cecchi Postmaster @ http://www.qboxmail.it https://www.linkedin.com/in/alessice