Retrieve emails in descending/reverse order using

2019-08-29 07:28发布

问题:

I am using mailkit currently to retrieve emails. I am using this code :

var message = inbox.GetMessage(i);
Emails Email = new Emails;
Email.From = message.From.ToString;
Email.EmailDate = message.Date.ToString;
InboxMails.Add(Email);

The problem is, as I am just retrieving the Dates, I can see that the emails are retrieved in the reverse order. I mean, Mailkit fetches the emails from the last email to the first where it should fetch from first to last. E.g. the last email in my mailbox is from 2/3/2014 and the first one is from 1/1/2018.

Now Mailkit loads the last one first and eventually gets to the first one, any way to retrieve in the correct descending order - from the first to the last email?

Also, is there a way to get a Unique Id for each message by which I can find / filter the messages?

I tried this :

 for (int i = inbox.Count -1; i >= 0; i--)

But it doesnt even return a single message