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 l
In order to create a MailItem from a .eml file you can use the following two steps: at first you open an outlook process instance and then you create the MailItem with the Outlook API.
string file = @"C:\TestEML\EmlMail.eml";
System.Diagnostics.Process.Start(file);
Outlook.Application POfficeApp = (Outlook.Application)Marshal.GetActiveObject("Outlook.Application"); // note that it returns an exception if Outlook is not running
Outlook.MailItem POfficeItem = (Outlook.MailItem)POfficeApp.ActiveInspector().CurrentItem; // now pOfficeItem is the COM object that represents your .eml file