0

我正在使用 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.

我无法理解为什么...

4

1 回答 1

1

[已解决] 我希望这有助于...并节省时间(我花了很多天...) javamail 和 apache CXF 之间存在冲突。apache cxf 有一个内部文件 geronimo-javamail_1.4_spec-1.7.1.jar .. 所以如果你将 mail.jar (javamail) 也添加到你的项目中并使用 IMAP 协议,它会产生类似上面的错误!

于 2017-10-12T05:59:12.560 回答