我试图从outlook中获取所有邮件标题,我成功登录该帐户并调用[session fetchAllFoldersOperation],即使抓取邮件也能正常工作。
我当时要求批量为50的所有标题。 我接收批处理消息非常慢,一些请求丢失。 我收到"无法建立到服务器的稳定连接。错误" 这只发生在outlook中,我对gmail或yahoo没有任何问题。
这是我的会话配置。
self.username = username;
self.password = password;
self.hostname = ^ NSString *(SCMMailProvider provider) {
if (provider == SCMServiceProviderGmail) {
return @"imap.gmail.com";
} else if (provider == SCMServiceProviderHotmail) {
return @"imap-mail.outlook.com";
} else if (provider == SCMServiceProvideriCloud) {
return @"imap.mail.me.com";
} else if (provider == SCMServiceProviderYahoo) {
return @"imap.mail.yahoo.com";
}
return nil;
}(provider);
if (provider == SCMServiceProvideriCloud || provider == SCMServiceProviderOther) {
self.mailsFolder = kSCMMailFolderInbox;
[self setAuthType:MCOAuthTypeSASLNone];
} else {
[self setOAuth2Token:password];
[self setUsername:username];
if (provider == SCMServiceProviderHotmail) {
[self setAuthType:MCOAuthTypeXOAuth2Outlook];
self.mailsFolder = kSCMMailFolderInbox;
} else if (provider == SCMServiceProviderGmail) {
[self setAuthType:MCOAuthTypeXOAuth2];
self.mailsFolder = kSCMGmailAllMessagesFolder;
}
}
MCOIMAPFetchMessagesOperation *fetchOp = [self fetchMessagesByNumberOperationWithFolder:self.mailsFolder
requestKind:MCOIMAPMessagesRequestKindStructure | MCOIMAPMessagesRequestKindHeaders
numbers:uidSet];
[fetchOp start:^(NSError *messageFetchingError, NSArray *msgs, MCOIndexSet *vanished) {
}