从pop3服务器发送格式错误的电子邮件 [英] sending a malformed email from pop3 server

查看:73
本文介绍了从pop3服务器发送格式错误的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在使用一个系统,该系统接收到损坏的电子邮件,阻止该系统提取卡在邮件服务器中的电子邮件.显然,不良电子邮件无法正常结束.我认为,按照协议,每封电子邮件都应以"\ r \ n.\ r \ n"结尾,但是,畸形的电子邮件似乎并没有像我所说的那样结束,从而导致检测大小问题,进而导致读取过多以及下一封电子邮件的问题.

我并不是说消息本身应该以"\ r \ n.\ r \ n"结尾.我问了一下我在代码中试图读取(来自生物连接的数据)并检测到"\ r \ n.\ r \ n"的问题.代码看到该字符串时,将缓冲区的结尾标记为"\ 0",并从正在从套接字读取内容的函数中成功返回;否则,如果找不到该字符串,则会显示一条错误消息,指示未找到结尾",然后返回失败.

我想知道如何创建和发送格式错误的电子邮件,以便可以接收并调试我们的系统以查看其如何解决此问题.

感谢您提供有关如何使用python,c#或c ++编写此类电子邮件的小型工具的信息.
谢谢,

Hey guys,
I am working on a system which receives a corrupted emails blocking the system from pulling emails which get stuck in the mail server. Apparently the bad emails do not end properly. I think according to protocol each email should end with "\r\n.\r\n", however, looks like the malformed emails don''t end like I said causing problem with detecting the size which in turn causes reading too much and problem with the next email.

I am not saying exactly that the message itself should be ended with "\r\n.\r\n". I made my question around what I see in the code where it is trying to read (data from bio connection)and detect "\r\n.\r\n". The code, when sees this string, marks the end of buffer with ''\0'' and returns successfully from the function which is reading the content from socket; otherwise, if it does not find the string prints an error indicating the ''end was not found'' and then returns unsuccessful.

I was wondering how can I create and send a malformed email, so I can receive it and debugge our system to see how it is reacting to this problem.

I appreciate any input on how to write a small tool using python, c# or c++ to send such an email.
Thanks,

推荐答案

您可以使用telnet程序手动连接到服务器.然后,您可以阅读纯文本邮件并查看出了什么问题,可以选择使用剪贴板复制内容,还可以选择删除格式错误的邮件:
You may use a telnet program to connect manually to the server. Then you can read the plain text mail and see what is wrong, optional copy the content using the clipboard, and optional delete the malformed mail:
> telnet <server> 110
+OK
user <user name>
+OK
pass <password>
+OK
stat
+OK 2 1980
list
+OK 2 messages (1980 octets)
1 1000
2 980
.
top 1 10
+ OK
<First 10 lines of mail no. 1>
.
retr 2
+OK
<Content of mail no. 2>
.
dele 2
+OK message 2 deleted
quit
+OK
>



[更新]
POP服务器发送".CRLF"序列以指示数据结束.请参阅RFC 1939 [ ^ ],"3.基本操作" ,第4个文本块,有关此内容以及如何处理包含终止序列的文本.邮件文本是否包含此顺序并不重要.

该问题是由接受无效邮件(应拒绝此类邮件)的邮件提供商SMTP服务器代码或设置引起的,或者由其本地邮件传递过程(可能会损坏邮件或插入无效的标头)引起. [/UPDATE]



[UPDATE]
The ".CRLF" sequence is send by the POP server to indicate the end of data. See RFC 1939 [^], "3. Basic Operation", 4th text block, about this and how text containing the termination sequence is handled. It does not matter if the mail text contains this sequence.

The problem is sourced by the mail providers SMTP server code or setup which accepts an invalid mail (such mails should be rejected), or by his local mail delivery procedure which may damage the message or insert invalid headers.
[/UPDATE]


这篇关于从pop3服务器发送格式错误的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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