Retrieve emails in descending/reverse order using MAILKIT c#

穿精又带淫゛_ 提交于 2019-12-13 03:33:12

问题


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

来源:https://stackoverflow.com/questions/49130306/retrieve-emails-in-descending-reverse-order-using-mailkit-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!