0
我需要将消息附件存储到本地硬盘驱动器..是否有任何解决方法实现此目的?我正在使用S22.Imap dllS22.Imap保存消息附件到本地硬盘
using (ImapClient Client = new ImapClient("imap.gmail.com", 993,
"[email protected]", "xxxxxxxxxx", S22.Imap.AuthMethod.Login, true))
{
uint[] uids = Client.Search(
SearchCondition.From("[email protected]").And(
SearchCondition.SentSince(new DateTime(2013, 5, 8))).And(
SearchCondition.SentBefore(new DateTime(2013, 5, 9)))
);
MailMessage[] messages = Client.GetMessages(uids,
(Bodypart part) =>
{
// We're only interested in attachments
if (part.Disposition.Type == ContentDispositionType.Attachment)
{
Int64 TwoMegabytes = (1024 * 1024 * 2);
if (part.Size > TwoMegabytes)
{
// Don't download this attachment
return false;
}
}
// fetch MIME part and include it in the returned MailMessage instance
return true;
}
);
string attachment_name;
if (messages[0].Attachments.Count > 0)
{
}
}
没有将这些附件保存到本地驱动器的内置方法。此外,这可以通过S22.Mail.dll库实现,但我无法找到这个库。有人可以提供我的解决方案吗? 这是S22.Mail源代码https://github.com/smiley22/S22.Mail的链接。
Hey Nikize。感谢您的回应。不幸的是,我不能测试这个,因为我没有在那个特定的项目上工作。不知何故,我已经使用了一些其他库来实现这个功能。谢谢。 – 2013-08-26 06:40:19