c0D3l0g1c
c0D3l0g1c

Reputation: 3164

IMAP Command for UID and MessageSize list

Writing a small portion of IMAP functionality in a c# .net application that basically lists all UIDS and their corresponding message sizes. I've looked at the IMAP RFC and can't find an ideal solution to get this info.

My approach:

  1. I use a combination of UID SEARCH ALL to give me all the UIDS, which is fast.
  2. Then I try to get all headers and read the size from that.

Step 2, is too slow - seems a bit silly to download the entire header, just to get the message size.

Is there a simple and/or fast solution for getting the list of UIDS and corresponding Message Sizes in a single command? If not, is there a much faster way of achieving this?

Upvotes: 0

Views: 1021

Answers (1)

Anshul
Anshul

Reputation: 1436

IMAP server provides various options in fetch command, u can use the following command to fetch mail size and corresponding uid as well

a1 fetch uid 1:* RFC822.SIZE

for more reference: https://www.rfc-editor.org/rfc/rfc3501#section-6.4.5

Upvotes: 2

Related Questions