Dart Requires Chilkat v11.0.0+
Dart
Extract Files from MIME
See more MIME Examples
Extract files from a MIME message.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final mime = CkMime();
// Load a MIME document from a file:
// (.mht and .eml files contain MIME).
try {
mime.loadMimeFile('mst.mht');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final st = CkStringTable();
try {
mime.partsToFiles('/temp/mimeParts', st);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final n = st.count;
// Display the paths of the files created:
var i = 0;
while (i < n) {
print(st.stringAt(i));
i++;
}
}