Rust Requires Chilkat v11.0.0+
Rust
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat Rust Downloads
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let mime = chilkat::Mime::new();
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
if mime.load_mime_file("mst.mht").is_err() {
println!("{}", mime.last_error_text());
return;
}
let st = chilkat::StringTable::new();
if mime.parts_to_files("/temp/mimeParts", &st).is_err() {
println!("{}", mime.last_error_text());
return;
}
let n = st.count();
// Display the paths of the files created:
let mut i = 0;
while i < n {
println!("{}", st.string_at(i).unwrap_or_default());
i = i + 1;
}