尝试获取大量收件人时出现MessagingException

时间:2014-09-01 14:40:23

标签: java javamail imap

我正在使用java邮件,并且在尝试从包含200多封邮件的电子邮件中获取收件人时收到MessagingException。

相同的代码适用于较少数量的收件人:

Address[] recipients = message.getRecipients(javax.mail.Message.RecipientType.TO);

例外:

javax.mail.MessagingException: Failed to load IMAP envelope
at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1274) ~[mail-1.4.7.jar:1.4.7]
at com.sun.mail.imap.IMAPMessage.getRecipients(IMAPMessage.java:298) ~[mail-1.4.7.jar:1.4.7]

IMAP追踪:

DEBUG: setDebug: JavaMail version 1.4.7
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: trying to connect to host "mail.myhost.com", port 143, isSSL false
* OK mail.myhost.com (cimap)
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4REV1 NAMESPACE QUOTA UIDPLUS IDLE SORT SURGEMAIL STARTTLS
A0 OK Capability completed
DEBUG IMAP: protocolConnect login, host=mail.myhost.com, user=test, password=<non-null>
DEBUG IMAP: LOGIN command trace suppressed
DEBUG IMAP: LOGIN command result: A1 OK login completed
A2 CAPABILITY
* CAPABILITY IMAP4 IMAP4REV1 NAMESPACE QUOTA UIDPLUS IDLE SORT SURGEMAIL STARTTLS
A2 OK Capability completed
DEBUG IMAP: connection available -- size: 1
A3 SELECT casos
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1409580447] Uid epoch
* OK [UIDNEXT 3] Predicted next uid
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded )
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Draft \Seen $Forwarded \*)] Limited
A3 OK [READ-WRITE] SELECT completed
A4 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE)
* 1 FETCH (UID 2 ENVELOPE (/*  PRIVATE INFO, BUT SHOWS ALL 200+ EMAIL ADDRESSES*/))
A4 OK FETCH completed

/* Here the exception is thrown */

A5 CLOSE
A5 OK CLOSE completed
DEBUG IMAP: added an Authenticated connection -- size: 1
A6 LOGOUT
* BYE IMAP4rev1 Server logging out 
A6 OK logout completed
DEBUG IMAP: IMAPStore connection dead
DEBUG IMAP: IMAPStore cleanup, force false
DEBUG IMAP: IMAPStore cleanup done

谢谢!

0 个答案:

没有答案