Sample code for 30+ languages & platforms
C# Requires Chilkat v11.0.0+

Pass an Email object to the MIME API

See more Email Object Examples

Serialize an Email into a fresh BinData buffer and load those bytes into Mime to inspect the tree. Keep the original file separately when byte-for-byte preservation matters, such as for DKIM verification.

Chilkat C# Downloads

C#
bool success = false;

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

Chilkat.Email email = new Chilkat.Email();
success = email.LoadEml("message.eml");
if (success != true) {
    Debug.WriteLine(email.LastErrorText);
    return;
}

Chilkat.BinData mimeBytes = new Chilkat.BinData();
success = email.GetMimeBd(mimeBytes);
if (success != true) {
    Debug.WriteLine(email.LastErrorText);
    return;
}

Chilkat.Mime mime = new Chilkat.Mime();
success = mime.LoadMimeBd(mimeBytes);
if (success != true) {
    Debug.WriteLine(mime.LastErrorText);
    return;
}

Debug.WriteLine(mime.GetStructure("text"));