+1 vote

I just ordered your mail library which I am very happy with.

I have a use case where I need to read message from an imap server without marking them as read.

I read this blog post:

I states that: "There are Peek methods for downloading headers and even parts of the email message."

How big a part of the message will be downloaded? Is it possible to download the full message using PeekMessageByUID?


1 Answer

0 votes
Best answer

PeekMessageByUID downloads entire email message, including all attachments (exactly the same set of data as GetMessageByUID method).

using(Imap imap = new Imap())
    imap.UseBestLogin("user", "password");

    List<long> uidList = imap.Search(Flag.Unseen);

    foreach (long uid in uidList)
        IMail email = new MailBuilder()

        string subject = email.Subject;

There are other Peek methods that allow getting only parts of email message, or headers only.

by (298k points)