gpt4 book ai didi

c# - MailKit Imap 仅获取 messageId

转载 作者:太空狗 更新时间:2023-10-30 00:40:15 24 4
gpt4 key购买 nike

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

最佳答案

试试这个:

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

这应该可以满足您的需求。

关于c# - MailKit Imap 仅获取 messageId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29632626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com