【发布时间】:2015-10-25 13:04:57
【问题描述】:
我使用控制台应用程序通过 IMAP 服务从邮件中下载文档。我在 IMAP 应用程序中使用“S22.Imap”程序集。我收到的所有邮件都包含 IEnumerable 中的附件。我怎样才能下载这些文件?
using (ImapClient client = new ImapClient(hostname, 993, username, password, AuthMethod.Login, true))
{
IEnumerable<uint> uids = client.Search(SearchCondition.Subject("Attachments"));
IEnumerable<MailMessage> messages = client.GetMessages(uids,
(Bodypart part) =>
{
if (part.Disposition.Type == ContentDispositionType.Attachment)
{
if (part.Type == ContentType.Application &&
part.Subtype == "VND.MS-EXCEL")
{
return true;
}
else
{
return false;
}
}
return true;
}
);
}
如果您给出解决方案,我将不胜感激
【问题讨论】:
-
在截图中,展开 Base 你应该得到ContentStream