我曾使用Mailcore
库在我的iOS应用程序上接收和发送电子邮件。
但是,我成功地使用了流行的电子邮件服务器,如Gmail,Ymail和Hotmail。
现在我正在尝试使用该库从邮件服务器[host.hyperpma.info]或其他电子邮件服务器获取电子邮件。
这是我的以下代码:
MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
[session setHostname:@"host.hyperpma.info"];
[session setPort:993];
[session setUsername:self.txtEmail.text];
[session setPassword:self.txtPassword.text];
[session setConnectionType:MCOConnectionTypeTLS];//I also try MCOConnectionTypeStartTLS
[session setCheckCertificateEnabled:NO];
MCOIMAPMessagesRequestKind requestKind = MCOIMAPMessagesRequestKindHeaders|MCOIMAPMessagesRequestKindFlags;
NSString *folder = @"INBOX";
MCOIndexSet *uids = [MCOIndexSet indexSetWithRange:MCORangeMake(1, UINT64_MAX)];
MCOIMAPFetchMessagesOperation *fetchOperation = [session fetchMessagesOperationWithFolder:folder requestKind:requestKind uids:uids];
// [SVProgressHUD show];
[fetchOperation start:^(NSError * error, NSArray * fetchedMessages, MCOIndexSet * vanishedMessages) {
//Let's check if there was an error:
if(error) {
NSLog(@"Error downloading message headers:%@", error);
}
}];
我收到错误如下:
Error downloading message headers:Error Domain=MCOErrorDomain Code=1 "A stable connection to the server could not be established." UserInfo=0x7fa6a1e3cdc0 {NSLocalizedDescription=A stable connection to the server could not be established.}
我在代码或设置中遗漏了什么吗?
请帮我解决这个问题。