javamail searchterm筛选报错 :nested exception is: com.sun.mail.iap.BadCommandExcept
如题 1// SearchTerm search = new MySearchTerm();
2SearchTerm search = new FromStringTerm(username);
3info = this.getAllMail(search);
4 this.messages = this.folder.getMessages();
5 this.messages =this.folder.search(search)
javamail收取邮件,采用imap协议。
在用第4句拿到所有的邮件时,正常显示,当使用第5句的筛选时,报如下的错误,不知道是什么原因。跪求答案!
A3 SEARCH FROM 1057720455@qq.com 1:33
A3 BAD Missing or invalid argument to SEARCH
Exception in thread "main" javax.mail.MessagingException: A3 BAD Missing or invalid argument to SEARCH;
nested exception is:
com.sun.mail.iap.BadCommandException: A3 BAD Missing or invalid argument to SEARCH
at com.sun.mail.imap.IMAPFolder.search(IMAPFolder.java:1714)
at com.ypan.mail.pop3.MailReceiver.getAllMail(MailReceiver.java:190)
at com.ypan.mail.pop3.MailReceiver.receiveAllMail(MailReceiver.java:106)
at com.ypan.mail.pop3.Test.main(Test.java:27) javamail? SearchTerm? imap
[解决办法]
分号。。。..
[解决办法]
this.messages =this.folder.search(search);
大括号不对,少分号
[解决办法]
楼上说的对A3 BAD Missing or invalid argument to SEARCH;