gpt4 book ai didi

java - 获取 Pop3message 的负大小

转载 作者:行者123 更新时间:2023-12-01 15:06:15 24 4
gpt4 key购买 nike

我要求我应该阅读邮件,并且我应该从邮件内容中获取一些标题信息。

为此,我正在按以下方式阅读邮件..

POP3Message objMsg = (POP3Message) instFolder.getMessage(totCount);   // line 1
String size = objMsg.getSize(); // line 2
System.out.println("size :: "+size); // line 3

Multipart multipartLevel_1 = (Multipart) objMsg.getContent(); // line 14
int nmultiCount = multipartLevel_1.getCount(); // line 15

在第 3 行我得到::size::-1050

在第 15 行,我收到 MessagingException 说..

javax.mail.MessagingException:没有来自数据源的输入流

你能告诉我为什么我收到的消息大小为负,它应该返回消息的字节数

在获取多部分对象时为什么我收到 MessagingException

提前致谢拉杰什五世

最佳答案

这是答案 - 谷歌确实有帮助:

Q: Why does the getSize method return a negative number when usingPOP3?

A: Your POP3 server is broken. The POP3 provider uses the TOPcommand to fetch the headers for the message and the LIST command todetermine the size of the entire message. It then subtracts the twovalues to determine the size of the message body. If the serverreports the size of the entire message incorrectly, you may get anegative number. You can set the property "mail.pop3.disabletop" to"true" to disable the use of the TOP command, but note that this willcause any access to the message headers to fetch the entire message.

来自Oracle JavaMailAPI FAQ

关于java - 获取 Pop3message 的负大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12909535/

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