+1 vote
by (160 points)

Is there a ways to get an Email MessageList since a last read, e.g. by giving a last read sequence number?
Would it be save to get this list by a previously stored sent date and get all > that sent date?

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (15.2k points)

Yes, it is possible to get mails from last read, but you have to use uniqueId instead of sequence number. You can achieve that by using this piece of code:

var set = new ImapMessageSet();
set.AddRangeFrom(lastUniqueId);
client.GetMessageList(set);

Please note that sequence number is valid for current session only. If you connect again and some message is deleted in the mean time, sequence numbers are regenerated to current session again.

by (160 points)
I would need something which is over a longer period the same. E.g. downloading emails from a mailfolder and only read what has come in addition in the time since last check.
by (15.2k points)
Just use the uniqueId, that will stay the same all the time. Even if the mail is deleted, the server should return messages after that unique id. You do not need to use dates at all. Just remember which uniqueId was the last you read and pass it to the ImapMessageSet as shown in my answer above.
...