Javamail appendMessages抛出IOException没有内容 [英] Javamail appendMessages throws IOException No Content

查看:88
本文介绍了Javamail appendMessages抛出IOException没有内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将邮件从一个IMAP存储复制到另一个.

I'm trying to copy messages from one IMAP store to another.

执行实际复制的代码行是:

The line of code that does the actual copying is:

folder.appendMessages(new Message[] { m });

大多数邮件复制都没有问题,但有些失败,并显示以下内容:

Most messages are copied with no problem, but some fail with:

javax.mail.MessagingException: IOException while appending messages;
  nested exception is:
    java.io.IOException: No content

堆栈跟踪指向在我的测试案例中,成功复制的某些消息最大为6MB,而一些失败的消息最小为16KB,所以这不是大小问题.

Some of the messages that were copied successfully were as large as 6MB, while some of the ones that failed were as small as 16KB in my test case, so it is not a size issue.

我不确定,但是失败的邮件可能带有附件.在失败的消息组和成功的消息组中都发现了内容类型multipart/ALTERNATIVE.

I'm not certain, but it's possible that the messages that fail has an attachment. The content type multipart/ALTERNATIVE was found in both in the group of messages that failed and the group that succeeded.

在像Thunderbird这样的邮件客户端中打开失败的消息可以正常工作,因此消息不会损坏.

Opening the failed messages in a mail client like Thunderbird works properly, so the messages are not corrupted.

mail.imap.fetchsize在此问题中起作用.当默认值为16,384b时,运行1000个消息的样本时,最小的失败消息为16,432b-略大于fetchsize.

mail.imap.fetchsize plays a role with this problem. When it is the default of 16,384b, running over a sample of 1000 messages the smallest failed message is 16,432b -- slightly over the fetchsize.

当我将其增加到65,536b时-同一样本的最小失败消息是65,787b-再次略微超过fetchsize.

When I increased it to 65,536b -- the smallest failed message of that same sample is 65,787b -- slightly over the fetchsize again.

使用默认fetchsize始终失败的大小为16,432b的消息,并使用较高的fetchsize成功复制了消息,因此这绝对是一个问题.

The message with size 16,432b that consistently failed with the default fetchsize, copied successfully with the higher fetchsize, so this is definitely an issue here.

有什么原因会导致此问题吗?

Any idea what causes this problem?

遇到此问题,如何复制邮件?

How can I copy the messages with having this issue?

TIA!

p.s.我正在使用Java 1.7u71和Javamail 1.5.2

p.s. I'm using Java 1.7u71 and Javamail 1.5.2

推荐答案

基于我们的离线讨论,将mail.imap.partialfetch属性设置为false会使它起作用.发生这种情况时,几乎总是因为服务器以某种方式损坏了.

Based on our offline discussion, setting the mail.imap.partialfetch property to false causes it to work. When that happens, it's almost always because the server is broken in some way.

另请参阅:

Javamail注释在已知局限性,错误,问题列表"部分下4和5.

Javamail Notes under "A list of the known limitations, bugs, issues" sections 4 and 5.

Javamail常见问题解答,提取

这篇关于Javamail appendMessages抛出IOException没有内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆