Failed to load IMAP envelope
843834Feb 23 2010 — edited Feb 23 2010I'm using the code below to simply test whether I can access messages in a specific account on Domino Server 8.something. At the moment, there are more than 3000 messages in this account, most of which are unread. The code works as I expect until I hit message 2675, which produces the following exception. I can produce this error by calling the following methods of the javax.mail.internet.MimeMessage class: getSubject(), getMessageID(), getFrom(). I've run this code on Ubuntu 9.0.4 as well as Mac OS X Snow Leopard. I've also compiled and executed this code using Java Mail 1.4.2 and Java Mail 1.4.3. I've posted my .properties file, the protocol debug statements, a code snippet, and a snippet from my log4j file so the point at which the error occurs is clear. I'm suspicious of the two quotation marks after NIL NIL in front of Steve Cooker"SCooker_SVP in the protocol debug statements. Thanks in advance for any input.
mail.store.protocol=imap
mail.transport.protocol=smtp
mail.debug.quote=true
mail.debug=true
mail.imap.port=143
A2678 FETCH 2675 (ENVELOPE INTERNALDATE RFC822.SIZE)
* 2675 FETCH (ENVELOPE ("Thu, 04 Feb 2010 09:24:52 -0500" "Monster To Acquire Yahoo!'s HotJobs" (("Steve Cooker" NIL "SCooker_SVP" "monster.com")) (("Steve Cooker" NIL "SCooker_SVP" "monster.com")) ((NIL NIL ""Steve Cooker"SCooker_SVP" "monster.com")) ((NIL NIL "stephanieh" "bsp-mail.com")) NIL NIL NIL "<emsg.6fbd.38b18.126995e8142@unica7emsg201.be.monster.com>") INTERNALDATE "04-Feb-2010 14:23:57 +0000" RFC822.SIZE 18662)
A2678 OK FETCH completed
2010-02-23 13:30:49,723 [main] DEBUG com.digitiliti.pyramid.email.mailet.test.EmailClient - checkInbox(): message 2675
2010-02-23 13:30:49,806 [main] ERROR com.digitiliti.pyramid.email.mailet.test.EmailClient -
javax.mail.MessagingException: Failed to load IMAP envelope
at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1196)
at com.sun.mail.imap.IMAPMessage.getFrom(IMAPMessage.java:223)
at com.digitiliti.pyramid.email.mailet.test.EmailClient.checkInbox(EmailClient.java:153)
at com.digitiliti.pyramid.email.mailet.test.EmailIngestorMailetTest.testEMailService(EmailIngestorMailetTest.java:57)
at com.digitiliti.pyramid.email.mailet.test.EmailIngestorMailetTest.main(EmailIngestorMailetTest.java:39)
public void checkInbox() throws MessagingException, IOException {
log.debug("checkInbox(): checking inbox...");
try {
Store store = session.getStore();
store.connect();
Folder root = store.getDefaultFolder();
Folder inbox = root.getFolder("inbox");
inbox.open(Folder.READ_WRITE);
Message[] msgs = inbox.getMessages();
if (msgs.length == 0) {
System.out.println("checkInbox(): No messages in mailbox.");
inbox.close(true);
store.close();
} else {
log.debug("checkInbox(): " + msgs.length + " messages in inbox.");
for (int i = 0; i < msgs.length; i++) {
MimeMessage mimeMessage = (MimeMessage) msgs;
log.debug("checkInbox(): message " + (i+1));
log.debug("checkInbox(): subject = " + mimeMessage.getFrom());
log.debug("checkInbox(): message ID = "+mimeMessage.getMessageID());
// try {
// writeToFile(mimeMessage);
// } catch (MessagingException e) {
// log.error(null, e);
// } catch (IOException io) {
// log.error(null, io);
// }
}
inbox.close(true);
store.close();
}
} catch (MessagingException e) {
log.error(null, e);
}
}