2

Im attempting to parse .msg files from outlook to get the MIME content in order to save the file as an eml. I'm using Exchange Web Services to save emls as they come through a journaled inbox on the exchange server, but some emails need to be saved after the fact through an outlook add in, though getting them into an eml/MIME format seems more difficult.

The example on the mimekit github page shows it can parse a msg file, though when I attempt it, a System.FormatException is thrown. Does mimekit support msg parsing?

This is what I am doing right now:

var stream = File.OpenRead(@"C:\example.msg");
var parser = new MimeParser(stream);
var msg = parser.ParseMessage();

Any amount of insight would be incredibly helpful.

1 Answers1

0

MSG format is not MIME - try to open it in Notepad. It is an OLE storage file. To open IStorage file, use StgOpenStorage.

See Difference between a .msg file and a .eml file

Community
  • 1
  • 1
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78