This package is a port of eml-parse-js wich reads and parses email messages saved in (clear text) EML format. It also reads attachments from the saved message.
Features
Parse and reads EML messages, with attachements.
Getting started
Include this library in your Android or IOS flutter App. For encoding and decoding it uses the package charset_converter which only works in an app environment.
Usage
See the example.
String eml = await File('./sample.eml').readAsString();
EmlParseResult result = await parseEml(eml);
print(result.from?.email);
print(result.to?.email);
print(result.subject);
print(result.text);
print(result.html);
if (result.attachments != null && result.attachments!.isNotEmpty) {
for (EmlEmailAttachment attachment in result.attachments!) {
print(
'Attachment: ${attachment.name} ${attachment.contentType} ${attachment.data.length}');
}
}