(.NET Core C#) Extract Files from MIME
Extract files from a MIME message. Note: This example requires Chilkat v11.0.0 or greater.
bool success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.Mime mime = new Chilkat.Mime();
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht");
if (success == false) {
Debug.WriteLine(mime.LastErrorText);
return;
}
Chilkat.StringTable st = new Chilkat.StringTable();
success = mime.PartsToFiles("/temp/mimeParts",st);
if (success == false) {
Debug.WriteLine(mime.LastErrorText);
return;
}
int n = st.Count;
// Display the paths of the files created:
int i = 0;
while (i < n) {
Debug.WriteLine(st.StringAt(i));
i = i + 1;
}
|