gpt4 book ai didi

java - Camel 邮件 IMAP 不跳过失败的邮件

转载 作者:行者123 更新时间:2023-12-02 03:12:43 25 4
gpt4 key购买 nike

我有路由“imap://%s@%s?password=%s&folderName=%s&unseen=true&delete=true&skipFailedMessage=true”来轮询电子邮件并跳过失败的电子邮件。此属性 skipFailedMessage=true 未得到尊重,或者我不了解它的用途。

我正在阅读来自 5 个具有不同占位符的不同邮箱的电子邮件,但当我遇到“org.apache.camel.RuntimeCamelException:无法提取正文,原因是:BASE64Decoder:编码流中出现错误:在之后找到有效的 base64 字符”时,没有读取任何电子邮件其中一封电子邮件上有一个填充字符 (=)”。如果失败的邮件被删除,我只能阅读不同邮箱中的所有其他电子邮件。请帮忙。我尝试了版本 2.17.3 和 2.18,两者的行为方式相同。

这是堆栈跟踪:

org.apache.camel.RuntimeCamelException: Failed to extract body due to: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=), the 10 most recent characters were: "xmlns:v="u". Exchange: Exchange[]. Message: com.sun.mail.imap.IMAPMessage@7883ab8c at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:278) at org.apache.camel.component.mail.MailMessage.createBody(MailMessage.java:105) at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47) at org.apache.camel.component.mail.MailConsumer.createExchanges(MailConsumer.java:354) at org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:128) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=), the 10 most recent characters were: "xmlns:v="u" at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:309) at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at com.sun.mail.handlers.text_plain.getContent(text_plain.java:98) at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795) at javax.activation.DataHandler.getContent(DataHandler.java:542) at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1454) at org.apache.camel.component.mail.MailBinding.extractBodyFromMail(MailBinding.java:250) ... 13 common frames omitted

最佳答案

该错误来自 JavaMail,可能是由于消息格式不正确造成的。您可以通过将系统属性“mail.mime.base64.ignoreerrors”设置为“true”来告诉JavaMail忽略此类错误。

关于java - Camel 邮件 IMAP 不跳过失败的邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40805154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com