+2 votes

I'm using the Limilabs Mail.dll in order to display in a listview the inbox mail. I have the necessity to go in and out about 50 mail address to check the seen/unseen mail. It's will be displayed into an listview box.

My problem is that the new mail on Inbox where detected with flag count at zero, but if I use the webmail service (aruba) the new mail is in bold (unseen).

by

1 Answer

0 votes
 
Best answer

To get the unseen emails use:

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

If you are using GetMessageInfoByUID method to download most common email data fast:

List<MessageInfo> infos = imap.GetMessageInfoByUID(uids)

use MessageInfo.Envelope.Flags collection.

You can also download flags for a particular email or emails:

List<Flag> flag = imap.GetFlagsByUID(uids)

Please note that although IMAP defines 2 flags:

  • \UNSEEN (Flag.Unseen)
  • \SEEN (Flag.Seen)

and allows searching using both (imap.Search(Flag.Unseen), imap.Search(Flag.Seen)) in the Flags collection you'll only find \SEEN flag.

All 'negative' flags, are just a short forms of saying NOT having the flag. So \UNSEEN is equivalent to NOT \SEEN, when searching.

Lack of \SEEN flag (Flag.Seen) in the Flags collection, means that the message is unseen.

by (297k points)
...