5

标题总结了它。我需要从 Imap 文件夹中获取所有 MessageId 属性,而无需下载整个消息。

...
IMailFolder inbox = imapClient.Inbox;
SearchQuery query = SearchQuery.All;

IList<UniqueId> idsList = inbox.Search(query);

foreach (var uid in idsList)
{
  MimeMessage message = inbox.GetMessage(uid);//This gets the entire message
    //but I only need the .MessageId, without getting the other parts
    if (message != null)
    {
       string messageId = message.MessageId;
    }
}
...
4

1 回答 1

8

试试这个:

var summaries = client.Inbox.Fetch (0, -1, MessageSummaryItems.Envelope);
foreach (var message in summaries) {
    Console.WriteLine (message.Envelope.MessageId);
}

那应该可以得到你想要的。

于 2015-04-15T12:37:28.777 回答