(Objective-C) Access Attached Message (Embedded Email)
How to access an email embedded within another email (i.e. an attached message).
#import <CkoEmail.h>
CkoEmail *email = [[CkoEmail alloc] init];
// Load an email from a .eml
BOOL success = [email LoadEml: @"embeddedEmail.eml"];
if (success != YES) {
NSLog(@"%@",email.LastErrorText);
return;
}
// Display how many attached emails are embedded within
// this one:
int numAttached = [email.NumAttachedMessages intValue];
NSLog(@"%@%d",@"numAttached = ",numAttached);
// Get the 1st attached message.
CkoEmail *email2 = 0;
email2 = [email GetAttachedMessage: [NSNumber numberWithInt: 0]];
if (email.LastMethodSuccess == YES) {
// Display the subject, From, and a header field...
NSLog(@"%@",email2.Subject);
NSLog(@"%@",email2.From);
NSLog(@"%@",[email2 GetHeaderField: @"X-SOMETHING"]);
}
|