+1 vote

Hi,

I purchased Mail.dll and I want to know how to:
1. Show unread email without affect read state
2. Read last 10 email exist

ago by

1 Answer

0 votes
 
Best answer

1.
Use Imap.PeekMessageByUID instead of Imap.GetMessageByUID to avoid seen/unseen state change, when downloading emails.

2.
To download last 10 messages use Imap.GetAll() and take 10 last uids:

List<long> uids = imap.GetAll();
List<long> latest10 = uids.TakeLast(10);

foreach (long uid in latest10)
{
    IMail email = new MailBuilder()
        .CreateFromEml(imap.PeekMessageByUID(uid));
    string subject = mail.Subject;
}
ago by (301k points)
...