【发布时间】:2011-08-24 11:49:25
【问题描述】:
首先,对不起我的英语。
我想在邮箱中显示附件名称文件列表。然后从这个列表中,用户可以选择他们想在硬盘上下载哪些附件——例如在这个程序中: http://www.mailresender.com.ar/Read.html
我已经在 Koolwired.Imap 中写过这个:
for (int i = 0; i < mbStructure.BodyParts.Count; i++) // i = number of parts of body
{
if (mbStructure.BodyParts[i].Attachment)
{
mbStructure = command.FetchBodyPart(mbStructure, i);
System.Console.WriteLine(mbStructure.BodyParts[i].Disposition); // Disposition contains file name
//System.Console.WriteLine(mbStructure.BodyParts[i].Data); // Data contains entire file
}
}
但问题是不仅文件名被加载到内存中,而且数据二进制文件(整个附件文件由 FetchBodyPart 方法加载) - 所以如果附件中的文件大小很长(例如 20 MB)所有这 20 MB 也必须加载到内存中,因此显示文件名列表将持续很长时间。
有没有办法只加载附件文件名而不加载文件? c# 中的哪个库可以支持这一点?
【问题讨论】:
标签: c# imap attachment