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