(Objective-C) POP3 Fetch a Single Email by UIDL
Demonstrates how to fetch a single email by UIDL.
#import <CkoMailMan.h>
#import <CkoStringArray.h>
#import <NSString.h>
#import <CkoEmail.h>
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoMailMan *mailman = [[CkoMailMan alloc] init];
mailman.MailHost = @"pop.example.com";
mailman.PopUsername = @"myLogin";
mailman.PopPassword = @"myPassword";
mailman.MailPort = [NSNumber numberWithInt:995];
mailman.PopSsl = YES;
CkoStringArray *sa = [mailman GetUidls];
if (mailman.LastMethodSuccess == NO) {
NSLog(@"%@",mailman.LastErrorText);
return;
}
// Download each email by UIDL.
NSString *uidl = 0;
int i = 0;
int numUidls = [sa.Count intValue];
while (i < numUidls) {
uidl = [sa GetString: [NSNumber numberWithInt: i]];
NSLog(@"%@",uidl);
CkoEmail *email = [mailman FetchEmail: uidl];
if (mailman.LastMethodSuccess == NO) {
NSLog(@"%@",mailman.LastErrorText);
return;
}
NSLog(@"%@",email.Subject);
NSLog(@"%@",@"");
i = i + 1;
}
|