<p>I need to read from Outlook .MSG file in .NET <em>without</em> using COM API for Outlook (cos it will not be installed on the machines that my app will run). Are there any free 3rd party libraries to do that? I want to extract From, To, CC and BCC fields. Sent/Receive date fields would be good if they are also stored in MSG files.</p>

[{'answer_id': 15893, 'author': 'Jarod Elliott', 'author_id': 1061, 'author_profile': 'https://Stackoverflow.com/users/1061', 'pm_score': 0, 'selected': False, 'text': '<p>If you open the .MSG file in a text editor, i believe you will find that the information you are after is stored as plain text inside the file. (It is on all the messages i have checked at least)</p>\n\n<p>It would be pretty easy to write some code to parse the file looking for lines beginning with "From:" or "To:" etc. and then extracting the information you need.</p>\n\n<p>If you need the body of the email as well, that may be a bit more complicated.</p>\n'}, {'answer_id': 16921, 'author': 'Robby Slaughter', 'author_id': 1854, 'author_profile': 'https://Stackoverflow.com/users/1854', 'pm_score': 3, 'selected': False, 'text': '<p>Microsoft has documented this: <a href="http://msdn.microsoft.com/en-us/library/cc463912.aspx" rel="nofollow noreferrer">.MSG File Format Specification</a></p>\n'}, {'answer_id': 19859, 'author': 'huseyint', 'author_id': 39, 'author_profile': 'https://Stackoverflow.com/users/39', 'pm_score': 4, 'selected': True, 'text': '<p><strong>Update:</strong> I have found a 3rd party COM library called <a href="http://www.dimastr.com/redemption/" rel="noreferrer">Outlook Redemption</a> which is working fine for me at the moment. If you use it via COM-Interop in .NET, don\'t forget to release every COM object after you are done with it, otherwise your application crashes randomly.</p>\n'}, {'answer_id': 20712, 'author': 'Shog9', 'author_id': 811, 'author_profile': 'https://Stackoverflow.com/users/811', 'pm_score': 2, 'selected': False, 'text': '<p>It\'s a "Structured Storage" document. I\'ve successfully used <a href="http://www.codeproject.com/KB/files/structstor.aspx" rel="nofollow noreferrer">Andrew Peace\'s code</a> to read these in the past, even under .NET (using C++/CLI) - it\'s clean and fairly easy to understand. Basically, you need to figure out which records you need, and query for those - it gets a little bit hairy, since different versions of Outlook and different types of messages will result in different records... </p>\n'}, {'answer_id': 1610351, 'author': 'Paul Batum', 'author_id': 48281, 'author_profile': 'https://Stackoverflow.com/users/48281', 'pm_score': 3, 'selected': False, 'text': '<p>There is code avaliable on CodeProject for reading .msg files without COM. See <a href="http://www.codeproject.com/KB/office/reading_an_outlook_msg.aspx" rel="noreferrer">here</a>.</p>\n'}, {'answer_id': 2365689, 'author': 'Knox', 'author_id': 4873, 'author_profile': 'https://Stackoverflow.com/users/4873', 'pm_score': 3, 'selected': False, 'text': '<p>Here\'s some sample VBA code using <a href="http://www.dimastr.com/redemption" rel="nofollow noreferrer">Outlook Redemption</a> that Huseyint found.</p>\n\n<pre><code>Public Sub ProcessMail()\n\n   Dim Sess As RDOSession\n   Dim myMsg As RDOMail\n   Dim myString As String\n\n   Set Sess = CreateObject("Redemption.RDOSession")\n   Set myMsg = Sess.GetMessageFromMsgFile("C:\\TestHarness\\kmail.msg")\n\n   myString = myMsg.Body\n   myMsg.Body = Replace(myString, "8750", "XXXX")\n\n   myMsg.Save\n\nEnd Sub\n</code></pre>\n'}, {'answer_id': 5582452, 'author': 'Martin Vobr', 'author_id': 16132, 'author_profile': 'https://Stackoverflow.com/users/16132', 'pm_score': 1, 'selected': False, 'text': '<p>You can try our (commercial) <a href="http://www.rebex.net/secure-mail.net/" rel="nofollow">Rebex Secure Mail</a> library. It can read Outlooks MSG format. Following code shows how:</p>\n\n<pre><code>// Load message\nMailMessage message = new MailMessage();\nmessage.Load(@"c:\\Temp\\t\\message.msg");\n\n// show From, To and Sent date\nConsole.WriteLine("From: {0}", message.From);\nConsole.WriteLine("To: {0}", message.To);\nConsole.WriteLine("Sent: {0}", message.Date.LocalTime);\n\n// find and try to parse the first \'Received\' header\nMailDateTime receivedDate = null;\nstring received = message.Headers.GetRaw("Received");\nif (received != null)\n{\n    int lastSemicolon = received.LastIndexOf(\';\');\n    if (lastSemicolon &gt;= 0)\n    {\n        string rawDate = received.Substring(lastSemicolon + 1);\n        MimeHeader header = new MimeHeader("Date", rawDate);\n        receivedDate = header.Value as MailDateTime;\n    }\n}\n\n// display the received date if available\nif (receivedDate != null)\n    Console.WriteLine("Received: {0}", receivedDate.LocalTime);\n</code></pre>\n\n<p>More info on Sent and Received dates and how are they represented in the message can be found at <a href="http://forum.rebex.net/questions/816/extract-senttime-receivetime-and-time-zones" rel="nofollow">http://forum.rebex.net/questions/816/extract-senttime-receivetime-and-time-zones</a></p>\n'}]
['https://Stackoverflow.com/questions/15880', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/39/']