MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.6k stars 623 forks source link

Error Domain=MCOErrorDomain Code=11 "The requested folder does not exist. Folder selection failed #1861

Open luojiyanyu opened 4 years ago

luojiyanyu commented 4 years ago

I have logged into mailbox 163 but cannot get it,The following code

MCOIMAPFetchMessagesOperation op = [self.imapSession fetchMessagesOperationWithFolder:@"INBOX" requestKind:MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure uids:uids]; [op start:^(NSError __nullable error, NSArray messages, MCOIndexSet vanishedMessages) { for(MCOIMAPMessage * msg in messages) { NSLog(@"%lu: %@", [msg uid], [msg header]); } }]; Log as follows: Printing description of error: Error Domain=MCOErrorDomain Code=11 "The requested folder does not exist. Folder selection failed" UserInfo={NSLocalizedDescription=The requested folder does not exist. Folder selection failed} Can you help me?

liuwei-1035 commented 3 years ago

Hello, I also encountered such a problem, did you solved the problem now?

liuwei-1035 commented 3 years ago

163 imap need IMAP ID(MCOIMAPIdentity in MailCore2) it worked eg: imapSession.clientIdentity.vendor = "SomeVendor" imapSession.clientIdentity.name = "SomeName" imapSession.clientIdentity.version = "1.0.0" reason: 如果您所使用的客户端因为该限制导致无法接收。请您联系软件开发人员更新相关源代码,在连接服务器时带上IMAP ID信息,相关JAVA示例代码如下:(其他语言或框架请联系对应开发者处理,网易仅提供JAVA语言示例代码。)

****代码块区域开始****

Properties props = new Properties(); props.setProperty("mail.store.protocol", "imap"); props.setProperty("mail.imap.host", "imap.163.com"); props.setProperty("mail.imap.port", "143");

HashMap IAM = new HashMap(); //带上IMAP ID信息,由key和value组成,例如name,version,vendor,support-email等。 IAM.put("name","myname");
IAM.put("version","1.0.0");
IAM.put("vendor","myclient");
IAM.put("support-email","testmail@test.com");
Session session = Session.getInstance(props);

IMAPStore store = (IMAPStore) session.getStore("imap"); //下方替换对应帐号和授权码 store.connect("testmail@163.com", "password");

store.id(IAM);

davidzhou23 commented 3 years ago

connection 断开之后好像还会出现这个问题,