There is no direct support for reading email messages in .NET. You have to hack your own (after day or two you'll be probably able to handle 95% of normal eml emails, after several months of hard work you'll be able to handle remaining 5%). Complete email parsing means correct handling of international characters, attachments, several encoding schemes, attachments, email messages sent as attachment, encrypted and signed emails, to be able to handle common errors of popular email clients, etc...
There are two common email file formats:
EML
Text-based format which can be found in both *nix and windows. Outlook Express and Thunderbird clients can read/write messages in eml format. If you are sending emails using .NET's SmtpClient using a PickupDirectory this format will be used. EML format is specified in RFC 2045, 2046, 2047, 2048, 2049, 2822.
You can find plenty of third party components for reading eml files. Following code uses our Rebex Secure Mail (but feel free to google your own).
using Rebex.Mail;
using Rebex.Mime.Headers;
// create an instance of MailMessage
MailMessage message = new MailMessage();
// load the message from a local disk file
message.Load("c:\\message.eml");
Console.Write(message.From);
Console.Write(message.To)
foreach (Attachment attachment in message.Attachments)
{
// Save the file
Console.WriteLine ("Saving '{0}' ({1}).",
attachment.FileName, attachment.MediaType);
attachment.Save (attachment.FileName);
}
You can download trial here.
MSG
Binary format used by Outlook. Microsoft published it's specification recently. There is a codeproject article with c# library which should be able to read it. There are also some third party commercial components but I haven't tried them personally.