通过IMAP读取字符串问题
我正在处理 IMAP,因此只需读取正文 (body[header.fields (DATE FROM SUBJECT)]) 我就传递此命令。
但问题是,有时我的字符串会返回除原始字符串之外的额外内容。 有时我得到的绳子的有限部分意味着身体的一半。 因此,每当我传递第二个命令时,它都会接受第一个命令并返回结果 第一个命令待定结果;
所以我担心的是我无法检索身体部位的正确数据。
根据我的知识,我认为这是由于互联网数据包 tresfersize 造成的,但除此之外,看看 Outlook 或任何其他邮件管理器都可以正常工作,所以这是什么机制 该数据正在检索。
或者我的编码要做的任何其他事情......
谢谢......
I am working on a IMAP, so just reading the body (body[header.fields (DATE FROM SUBJECT)]) I am passing this command.
But problem is like there some time my string return extra stuff excetp from my original string.
and some times I had getting limited part of the string means half part of the body.
so whenever I am passing second command it will accept as a first command and return result as the
first command pending resul.;
so the my concern is that I am not able to retrive proper data as of the part of the body.
as per my knowladge I think it's happen due to the internet datapacket tresfersize, but apart from this look at outlook or any other mail manager will work properly so what this is the mechanisam for
this data retriving.
or anything else to do fo my coding.....
Thanks..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 IMAP 服务器发布包含“额外内容”的示例响应会有所帮助。
您最有可能面临的问题是未标记的服务器响应。
RFC3501 的内容如下:
状态响应可以标记或取消标记。带标记的状态响应指示客户端命令的完成结果(OK、NO 或 BAD 状态),并具有与命令匹配的标记:
某些状态响应和所有服务器数据均未标记。一个
未标记的响应由标记“*”而不是标记来指示。
因此,您需要区分这两种响应类型。
请记住,检查每个收到的行是否都以“*”字符开头是不够的,因为您的电子邮件也可能包含以星号字符开头的行:
{342} 是您应该读取的确切字节数。
最重要的是不要使用现有的库重新发明轮子。
您可以查看我的 IMAP 组件(不是免费的)。
Posting a sample response from the IMAP server that contains the "extra stuff" would help.
The problem you are most likely facing is with untagged server responses.
Heres what RFC3501 says:
Status responses can be tagged or untagged. Tagged status responses indicate the completion result (OK, NO, or BAD status) of a client command, and have a tag matching the command:
Some status responses, and all server data, are untagged. An
untagged response is indicated by the token "*" instead of a tag.
So you need to distinguish between those 2 response types.
Please remember that checking if every received line starts from '*' character is not enough, as your email message may also have lines starting from star character:
{342} is the exact number of bytes you are supposed to read.
The bottom line is don't reinvent the wheel use existing library.
You can check out mine IMAP component (not free).