PeekMessageByUID
downloads entire email message, including all attachments (exactly the same set of data as GetMessageByUID
method).
using(Imap imap = new Imap())
{
imap.ConnectSSL("imap.example.com");
imap.UseBestLogin("user", "password");
imap.SelectInbox();
List<long> uidList = imap.Search(Flag.Unseen);
foreach (long uid in uidList)
{
IMail email = new MailBuilder()
.CreateFromEml(imap.PeekMessageByUID(uid));
string subject = email.Subject;
}
imap.Close();
}
There are other Peek methods that allow getting only parts of email message, or headers only.