当使用 telnet 或 netcat 测试外发 SMTP 电子邮件时,我无法以“.”结尾消息。自己在一条线上'

use*_*485 3 linux bash

当通过 telnet 或 netcat 向我的 ISP 的 SMTP 服务器发送简单的电子邮件时,我无法用句点终止该消息。最终连接超时但消息未传递。

root@zeus:/tmp# telnet mail.charter.net 25
220 imp09 smtp.charter.net ESMTP server ready 20110115 000442
HELO charter.net
250 imp09 hello [97.94.115.109], pleased to meet you
MAIL FROM: test@gmail.com
250 2.1.0 <test@gmail.com> sender ok
RCPT TO: test@gmail.com
250 2.1.5 <test@gmail.com> recipient ok
DATA
354 enter mail, end with "." on a line by itself
test body

.

.

/n.
/n
.

\n
.

QUIT
Run Code Online (Sandbox Code Playgroud)

这在同一网络上的另一台计算机和具有不同版本的 telnet 的 ISP 上运行良好。

netcat 在两台计算机上以相同的方式挂起。

我认为这可能与 LINEMODE 有关,因为无法发送电子邮件的 telnet 会话处于 LINEMODE 状态,无法切换到 CHARMODE。有什么解决方法吗?

ʇsә*_*ɹoɈ 5

您发送的换行符可能只是回车符或换行符。SMTP 需要回车符后跟换行符来结束一行。

https://www.rfc-editor.org/rfc/rfc5321#section-2.3.8

https://www.rfc-editor.org/rfc/rfc5321#section-4.1.1.4

尝试使用 Control-M Control-J、使用不同的终端程序和/或使用 telnet 以外的其他程序来结束每一行。