Is there a class or set of functions built into the .NET Framework (3.5+) to parse raw emails (MIME documents)?
I am not looking for anything fancy or a separate lib
I know you said no external libraries, but I have a library posted on codeplex:
https://bitbucket.org/otac0n/mailutilities
MimeMessage msg = new MimeMessage(/* string, stream, or Byte[] */);
It has been tested with over 40,000 real-world mail messages.
I'm not too happy with my namespace choice, but... I'm too lazy to change it.
Internally, my library uses these regexes as a parser:
internal static string FullMessageMatch =
@"\A(?(?:[^\r\n]+\r\n)*)(?\r\n)(?.*)\z";
internal static string HeadersMatch =
@"^(?[-A-Za-z0-9]+)(?:[ \t]*)(?([^\r\n]|\r\n[ \t]+)*)(?\r\n)";
internal static string HeaderSeperator =
"\r\n";
internal static string KeyValueSeparator =
@"\A:[ \t]*\z";