即使邮箱中存在邮件,为什么JavaMail也不列出电子邮件?

时间:2018-10-30 14:53:48

标签: java javamail imap

我正在使用JavaMail API 1.5.3版本使用IMAP从邮箱中提取电子邮件。

邮箱中有近500封电子邮件,但是JavaMail API并未列出其中的任何一封电子邮件。我配置了一个Outlook客户程序,并将电子邮件正确下载到那里。

下面是调试跟踪:

 DEBUG: JavaMail version 1.5.3
 DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
 DEBUG: Tables of loaded providers
 DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}

 DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}

 DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
 DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]
 DEBUG IMAP: mail.imap.fetchsize: 16384



 DEBUG IMAP: mail.imap.ignorebodystructuresize: false
 DEBUG IMAP: mail.imap.statuscachetimeout: 1000
 DEBUG IMAP: mail.imap.appendbuffersize: -1

 DEBUG IMAP: mail.imap.minidletime: 10

 DEBUG IMAP: closeFoldersOnStoreFailure

 DEBUG: setDebug: JavaMail version 1.5.3

 DEBUG IMAP: trying to connect to host "< mail server nane >", port 993, isSSL true

 * OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE AUTH=PLAIN SASL-IR] server ready

 DEBUG IMAP: AUTH: PLAIN

 DEBUG IMAP: protocolConnect login, host=<mail server name>, user=<username>, password=<non-null>

 DEBUG IMAP: AUTHENTICATE PLAIN command trace suppressed

 DEBUG IMAP: AUTHENTICATE PLAIN command result: A0 OK [CAPABILITY IMAP4rev1 LITERAL+ ID ENABLE ACL RIGHTS=kxte QUOTA MAILBOX-REFERRALS NAMESPACE UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY CATENATE CONDSTORE ESEARCH SORT SORT=MODSEQ SORT=DISPLAY THREAD=ORDEREDSUBJECT THREAD=REFERENCES ANNOTATEMORE LIST-EXTENDED WITHIN QRESYNC SCAN XLIST URLAUTH URLAUTH=BINARY X-NETSCAPE LOGINDISABLED COMPRESS=DEFLATE IDLE] Success (tls protection) SESSIONID=<netserv-28720-1540905648-1>


 DEBUG IMAP: connection available -- size: 1

 A1 SELECT INBOX

 * 0 EXISTS

 * 0 RECENT

 * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)

 * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] Ok

 * OK [UIDVALIDITY 1519903897] Ok

 * OK [UIDNEXT 274] Ok

 * OK [HIGHESTMODSEQ 437] Ok

 * OK [URLMECH INTERNAL] Ok

 A1 OK [READ-WRITE] Completed

 A2 SEARCH UNSEEN ALL

 * SEARCH

 A2 OK Completed (0 msgs in 0.000 secs)


 A3 SEARCH UNSEEN ALL

 * SEARCH

 A3 OK Completed (0 msgs in 0.000 secs)

 A4 CLOSE

 A4 OK Completed

 DEBUG IMAP: added an Authenticated connection -- size: 1

 DEBUG IMAP: IMAPProtocol noop

 A5 NOOP

 A5 OK Completed

 A6 LOGOUT

 * BYE LOGOUT received

 A6 OK Completed

 DEBUG IMAP: IMAPStore connection dead

 DEBUG IMAP: IMAPStore cleanup, force false

 DEBUG IMAP: IMAPStore cleanup done

有人可以指出问题所在吗?

1 个答案:

答案 0 :(得分:2)

这几乎清楚地表明服务器说服务器在收件箱中没有消息:

A1 SELECT INBOX
* 0 EXISTS
* 0 RECENT

它们在另一个文件夹中,或者在另一个帐户中。