我正在使用Jodd版本3.9,我想阅读Outlook帐户(Microsoft Exchange)。 ]
int port = 993;
ImapSslServer imapServer = new ImapSslServer("mail.myhost.it", port, "authuser", "authpass");
imapServer.setProperty("mail.imap.connectiontimeout", "15000");
ReceiveMailSession session = imapServer.createSession();
session.open();
_log.info("total number of inbox emails : " + session.getMessageCount());
ReceivedEmail[] emails = session.receiveEmailAndMarkSeen(EmailFilter.filter().flag(Flags.Flag.SEEN, false));
但我在第session.receiveEmailAndMarkSeen(...)
jodd.mail.MailException: Message parsing failed; <---
java.lang.NullPointerException
这是一个调试:
A8 FETCH 4 (BODYSTRUCTURE)
* 4 FETCH (BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 1401 35 NIL NIL NIL NIL) "mixed" ("boundary" "----=_Part_1029639_1159929762.1507643405808") NIL NIL))
[ERROR] 11 ott 04:57:31.467 PM [com.afterbit.jobs.EmailJob] (mGxTfT0) EXCEPTION session.receiveEmailAndMarkSeen : jodd.mail.MailException: Message parsing failed; <--- java.lang.NullPointerException
A9 CLOSE
A8 OK FETCH completed.
A9 OK CLOSE completed.
我无法理解为什么......
答案 0 :(得分:1)
[求助]我希望这有帮助...并节省时间(我已经花了很多天..) javamail和apache CXF之间存在冲突。 apache cxf有一个内部文件geronimo-javamail_1.4_spec-1.7.1.jar ..所以如果你在项目中添加mail.jar(javamail)并使用IMAP协议,它会产生如上所述的错误!