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.
PS:
Internally, my library uses these regexes as a parser:
internal static string FullMessageMatch =
@"\A(?<header>(?:[^\r\n]+\r\n)*)(?<header_term>\r\n)(?<body>.*)\z";
internal static string HeadersMatch =
@"^(?<header_key>[-A-Za-z0-9]+)(?<seperator>:[ \t]*)(?<header_value>([^\r\n]|\r\n[ \t]+)*)(?<terminator>\r\n)";
internal static string HeaderSeperator =
"\r\n";
internal static string KeyValueSeparator =
@"\A:[ \t]*\z";