Set the maximum messages for an IMAPMessageCollection

0
We want to download messages in a folder which are older than X days. That part seems easy with IMAPCrition and IMAPMessageCollection. However, we only want to return up to a maximum number at a time. Otherwise, it may have to pull 10,000+ messages. I know in the BounceInspector, you can set MaxMessages. However, I can't figure out how to do it when trying to pull messages based on criteria.
edited 11/30/2017 2:28:38 AM
asked 12/21/2011 11:23:51 PM
add a comment

1 Answers

0
You can list messages first and download them later.

ImapMessageCollection list = ListMessages(EnvelopeParts.UniqueId, yourCriteria);

for (int i = 0; i < 1000 && i < list.Count; i++)
{
       ImapMessage imapMsg = list[i];
       MailMessage msg = client.DownloadMessage(imapMsg.UniqueId);
}
 
answered 11/16/2017 12:41:36 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged imap or ask your own question.