如题 1 // SearchTerm search = new MySearchTerm();
2 SearchTerm search = new FromStringTerm(username);
3 info = 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)
------解决方案--------------------
分号。。。..
------解决方案--------------------
this.messages =this.folder.search(search);
大括号不对,少分号
------解决方案--------------------
楼上说的对A3 BAD Missing or invalid argument to SEARCH;