如何在C#中使用Outlook MAPI来打开.eml文件?文件、如何在、MAPI、Outlook

由网友(葬)分享简介:我有一个C#应用程序读取.msg文件并提取正文和附件。但是,当我尝试加载.eml文件的应用程序崩溃。我加载像这样的文件:I have a C# application that reads .msg files and extracts the body and the attachments. But when I...

我有一个C#应用程序读取.msg文件并提取正文和附件。但是,当我尝试加载.eml文件的应用程序崩溃。我加载像这样的文件:

I have a C# application that reads .msg files and extracts the body and the attachments. But when I try to load a .eml file the application crashes. I am loading the files like this:

MailItem mailItem = (MailItem)outlookApp.CreateItemFromTemplate(msgFileName);
mailItem.SaveAs(fullFilename, OlSaveAsType.olHTML); // save body in html format
for(int i = 0; i < mailItem.Attachments.Count; i++)
    mailItem.Attachments[i].SaveAsFile(filename); // save attachments

这正常工作与.msg文件,但它并不适用于.eml文件的工作。我不明白为什么.eml文件不工作,因为我可以在Outlook 2010中打开.eml文件。

This works fine with .msg files, but it doesn't work for .eml files. I don't understand why .eml files don't work, because I can open .eml files in Outlook 2010.

我如何可以加载的.eml使用Outlook 主Interop大会?

How can I load .eml files using the Outlook Primary Interop Assembly?

推荐答案

试试这个示例code的容易从.eml文件

Try this sample code Easily Retrieve Email Information from .EML Files

阅读全文

相关推荐

最新文章