Efficient FETCH query and parsing results

Mar 4, 2014 at 5:51 PM
I'm tying to use MailSystem.NET to read ALL mail (except for stuff in Drafts, I guess) and extract the UUID, the Date, the Sender, all Recipient emails.

I would like to have it fetch, beginning at the most recent and continue scanning backwards, loading batches of maybe 100 headers at a time.

If new emails come in during this operation, I don't want the message index change to affect the progress.

I'd like some advice on this. It seems to me that the Fetch() wrappers work on individual messages and that inbox search functionality gives message index ordinals rather than UIDs. I believe UIDs would be more robust to concurrent activity.

I can call imap.Command("fetch 1:100 (uid rfc822.header)") but then I don't know how to use MailSystem.NET to parse the results.

Also, is there a way to say "get the next 100 messages with UID less than the last seen UID"? If it is safe to assume that UIDs always increase with later messages. I mean this to be an alternative to basing it on the message index ordinal.