简体   繁体   English

MailKit Imap获取邮件大小

[英]MailKit Imap Get Mail Size

I use mailkit library to read imap mails. 我使用mailkit库读取imap邮件。 I want to get mail with it's size. 我想收到尺寸合适的邮件。 In Pop3 I can read mail size with; 在Pop3中,我可以读取邮件大小;

clientPop.GetMessageSize("messageId");

In Imap,how can I do that? 在Imap中,我该怎么做?

The way to get message metadata in IMAP is to use the Fetch() method on the folder. 在IMAP中获取消息元数据的方法是在文件夹上使用Fetch()方法。 If you want to get the size of each message, you could do: 如果要获取每个消息的大小,可以执行以下操作:

foreach (var summary in inbox.Fetch (0, -1, MessageSummaryItems.Size)) {
    Console.WriteLine ("The size of message {0} is {1}", summary.Index, summary.Size.Value);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM