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");