How to get rid of 'Failed to load IMAP envelope' Messaging Exception?

北战南征 提交于 2019-12-19 11:48:55

问题


I am trying to get the list of emails by Message msg[] = folder.getMessages();. After that I am getting the details of each message, meanwhile I am getting javax.mail.MessagingException: Failed to load IMAP envelope exception for some message.

This is protocol trace for the one message which producing error -

A7 FETCH 2 (ENVELOPE INTERNALDATE RFC822.SIZE)
* 2 FETCH (RFC822.SIZE 2567 INTERNALDATE "29-Apr-2011 13:49:01 +0000" ENVELOPE ("Fri, 29 Apr 2011 19:19:01 +0530" "I NEES YOUR ASSISANCE?????" (("Mr Leung Cheung" NIL "info" "milium.com.br")) (("Mr Leung Cheung" NIL "info" "milium.com.br")) ((NIL NIL "mr.leung_cheung" "live.hk")) () NIL NIL NIL "<20110429134718.70333732030A@mail2.milium.com.br>"))
A7 OK FETCH Completed

Stacktrace of error is-

Failed to load IMAP envelope stacktrace: javax.mail.MessagingException: Failed to load IMAP envelope
    at com.sun.mail.imap.IMAPMessage.loadEnvelope(IMAPMessage.java:1276)
    at com.sun.mail.imap.IMAPMessage.getSentDate(IMAPMessage.java:377)
    at com.my.main.model.TestMail.showAllMails(TestMail.java:95)
    at com.my.main.model.TestMail.main(TestMail.java:45)

I am using JavaMail-1.5.

How can I resolve this error, is there any way or settings to solve it and get details of message without skipping that message?

Thanks,

Neelam Sharma


回答1:


Your server is broken. Please report this error to the server vendor. What server are you using?

In the response, the message's "To" value must meet this syntax defined in the spec:

env-to      = "(" 1*address ")" / nil
address     = "(" addr-name SP addr-adl SP addr-mailbox SP addr-host ")"

Instead, the server has returned "()". It should've returned "NIL" if there is no To header.

You can work around server bugs using the technique described in the JavaMail FAQ.



来源:https://stackoverflow.com/questions/19112579/how-to-get-rid-of-failed-to-load-imap-envelope-messaging-exception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!