Outlook Redemption是目前使用我找到的最好的東西。它將允許您進入消息並提取附件和消息主體。我現在正在使用它來做到這一點。
這是我在課堂上使用的一些代碼。我包含了構造函數和用於保存附件的處理函數。我刪除了特定於我的需求的代碼,但您可以瞭解在此使用的代碼。
private RDOSession _MailSession = new RDOSession();
private RDOFolder _IncommingInbox;
private RDOFolder _ArchiveFolder;
private string _SaveAttachmentPath;
public MailBox(string Logon_Profile, string IncommingMailPath,
string ArchiveMailPath, string SaveAttPath)
{
_MailSession.Logon(Logon_Profile, null, null, true, null, null);
_IncommingInbox = _MailSession.GetFolderFromPath(IncommingMailPath);
_ArchiveFolder = _MailSession.GetFolderFromPath(ArchiveMailPath);
_SaveAttachmentPath = SaveAttPath;
}
public void ProcessMail()
{
foreach (RDOMail msg in _IncommingInbox.Items)
{
foreach (RDOAttachment attachment in msg.Attachments)
{
attachment.SaveAsFile(_SaveAttachmentPath + attachment.FileName);
}
}
if (msg.Body != null)
{
ProcessBody(msg.Body);
}
}
}
編輯: 這是我怎麼稱呼它,什麼是通過
MailBox pwaMail = new MailBox("Self Email User", @"\\Mailbox - Someone\Inbox",
@"\\EMail - Incomming\Backup", @"\\SomePath");