有没有人遇到过这个异常?我不知道是什么问题。
javax.mail.MessagingException:A415 NO [UNAVAILABLE] FETCH 服务器在获取消息时出错;嵌套异常是:com.sun.mail.iap.CommandFailedException: A415 NO [UNAVAILABLE] FETCH Server error while fetching messages at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1268) at com.sun.mail .imap.IMAPMessage.getReceivedDate(IMAPMessage.java:393) 在 eu.memshare.modules.mail.UserMail$3.match( UserMail.java:805 ) 在 javax.mail.Message.match(Message.java:705) 在 javax .mail.Folder.search(Folder.java:1270) 在 com.sun.mail.imap.IMAPFolder.search(IMAPFolder.java:1918) 在 javax.mail.Folder.search(Folder.java:1231) 在 com。 sun.mail.imap.IMAPFolder.search(IMAPFolder.java:1873) 在 eu.memshare.modules.mail.UserMail.fetchMail( UserMail.java:823) at eu.memshare.modules.mail.UserMail.run( UserMail.java:772 ) 原因:com.sun.mail.iap.CommandFailedException: A415 NO [UNAVAILABLE] FETCH Server error while fetching messages at com.sun.mail .iap.Protocol.handleResult(Protocol.java:351) at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1263) ... 还有 9 个
这是引发异常的代码:
SearchTerm term = new SearchTerm() {
@Override
public boolean match(Message message) {
try {
if(message.isExpunged()){
inbox.expunge();
return false;
}else if(message.getFlags().contains(Flags.Flag.DELETED)) {
return false;
}
long min = Math.min(System.currentTimeMillis(), lastQueryDate.getTime());
Date when = new Date(min);
Date receivedDate = message.getReceivedDate();
boolean after = when.before(receivedDate);
if (all) {
return true;
} else if (after) {
lastQueryDate = receivedDate;
return true;
}
} catch (MessagingException e) {
e.printStackTrace();
return false;
}
return false;
}
};