This project is read-only.

Download only header

Mar 3, 2013 at 9:57 AM
Edited Mar 3, 2013 at 10:31 AM
Now my program download full message (IMAP)
    private MessageCollection GetMails(string mailBox, string searchPhrase)
    {
        Mailbox mails = Client.SelectMailbox(mailBox);
        MessageCollection messages = mails.SearchParse(searchPhrase);
        return messages;
    }

    public IEnumerable<Message> GetReadMails(string mailBox)
    {
        return GetMails(mailBox, "SEEN").Cast<Message>();
    }
but I want
  1. Download only header
  2. Selecting message when i want download full message (something messegeID or using Flags)
  3. Download selecting full message
Do you help me?

PS. Sorry for my poor english
Apr 4, 2013 at 1:38 PM
Hi,

you can use the Fetch object for this:
Mailbox mb = client.SelectMailbox("INBOX");
for (int i = 1; i < mb.MessageCount; i++) {
   string header = mb.Fetch.HeaderString(i);
   // alternative: 
   Header header = mb.Fetch.HeaderObject(i);
}
The full message can be retrieved with
string message = mb.Fetch.MessageString(i);
// alternative
Message message = mb.Fetch.MessageObject(i);