标题总结了它。我需要从 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;
}
}
...