Dart Requires Chilkat v11.0.0+
Dart
Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
final email = CkEmail();
// Load an email from a .eml
try {
email.loadEml('embeddedEmail.eml');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
// Display how many attached emails are embedded within
// this one:
final numAttached = email.numAttachedMessages;
print('numAttached = $numAttached');
// Get the 1st attached message.
final email2 = CkEmail();
try {
email.getAttachedEmail(0, email2);
// Display the subject, From, and a header field...
print(email2.subject);
print(email2.from);
print(email2.getHeaderField('X-SOMETHING'));
} on ChilkatException {
// email.getAttachedEmail() failed; continue anyway.
}
}