【发布时间】:2016-11-05 19:24:16
【问题描述】:
我正在使用 Apache Commons Net,我的目标是获取现有 Gmail 文件夹的列表。我正在尝试以下代码:
IMAPClient imap = new IMAPSClient();
imap.setDefaultPort(port);
imap.addProtocolCommandListener(new PrintCommandListener(System.out, true));
imap.connect(server);
imap.login(username, password);
imap.list("", "*")
但它给了我:
I/System.out: * OK Gimap ready for requests from 5.18.55.93 fi8mb55620436ldc
I/System.out: AAAA LOGIN *******
I/System.out: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- APPENDLIMIT=35651584
I/System.out: AAAA OK rextuz@gmail.com authenticated (Success)
I/System.out: AAAB LIST *
I/System.out: AAAB BAD Could not parse command
我需要服务器为我提供文件夹列表,因为可能存在自定义或本地化文件夹。
【问题讨论】:
标签: java gmail imap apache-commons-net