​ imap在办公室365上产生MesdagingException / MessageAgeMevioException

发布于 2025-01-31 15:29:06 字数 1229 浏览 4 评论 0原文

我尝试通过IMAP和Spring IntegrationFlow获取一些消息。以下代码运行良好(自4年以来),直到邮箱移至Office 365。

return IntegrationFlows
                .from(Mail.imapInboundAdapter(imapMailReceiver).get(),
                        e -> e.autoStartup(true)
                                .poller(Pollers.cron(properties.getCron(), TimeZone.getTimeZone("Europe/Paris"))
                                        
                                        .maxMessagesPerPoll(MAILS_PER_POLL)
                                        .errorHandler(mailReceiverErrorHandler("imapMailReceiver", param, portefeuille))
                                )
                )
                
                .log(LoggingHandler.Level.DEBUG, m -> loggerMessageMail(m, "IMAP"))
                .channel(c -> mailChannel)
                .get();

现在,我们有时会得到此例外:

Exception: failure occurred while polling for mail; nested exception is javax.mail.MessagingException: IOException while copying message; nested exception is: com.sun.mail.util.MessageRemovedIOException

经过一些研究,当您尝试获取消息时,会发生这种例外。让我们考虑一下,我无法更改Office 365服务器或对其进行一些操作(例如清洁删除的消息...)

是否可以在集成流上过滤这些消息以避免此异常?

I try to get some messages with IMAP and Spring IntegrationFlow. The following code is working well (since 4 years) until the mailbox moved to Office 365.

return IntegrationFlows
                .from(Mail.imapInboundAdapter(imapMailReceiver).get(),
                        e -> e.autoStartup(true)
                                .poller(Pollers.cron(properties.getCron(), TimeZone.getTimeZone("Europe/Paris"))
                                        
                                        .maxMessagesPerPoll(MAILS_PER_POLL)
                                        .errorHandler(mailReceiverErrorHandler("imapMailReceiver", param, portefeuille))
                                )
                )
                
                .log(LoggingHandler.Level.DEBUG, m -> loggerMessageMail(m, "IMAP"))
                .channel(c -> mailChannel)
                .get();

Now, we sometimes get this exception:

Exception: failure occurred while polling for mail; nested exception is javax.mail.MessagingException: IOException while copying message; nested exception is: com.sun.mail.util.MessageRemovedIOException

After some research, this exception occurs when your try to get an expunged message. Let's consider that I can't change the Office 365 server or do some action on it (like clean expunged messages...)

Is there a way to filter on the IntegrationFlow those messages to avoid this exception ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文