maybe yes 发表于 2016-04-25 20:32

最近使用 SMTP 协议连接 126 邮箱 smtp.126.com 发了一封邮件,开始几次都没有测试成功,一直提示 DT:SPM,在 126 服务器返回的链接中可以看到是被系统判定为垃圾邮件。如下响应:

554 DT:SPM 126 smtp6,j9KowAAHDGR3yR1Xi0s2CA--.28401S5 1461570156,
please see http://mail.163.com/help/help_spam_16.htm?ip=

百度百科和 WikiPedia 维基百科上对 SMTP 协议的介绍就会发现,百度百科有很多细节上的错误。最终查看维基的示例成功发了邮件。完整的示例如下,对一些敏感信息做了修改

➜  may git:(feature-160425) telnet smtp.126.com 25
S: Trying
S: Connected to smtp.126.com.
S: Escape character is '^]'.
S: 220 126.com Anti-spam GT for Coremail System (126com[20140526])
C: HELO smtp.126.com
S: 250 OK
S: 334 dXNlcm5hbWU6
C: base64usernamestr
S: 334 UGFzc3dvcmQ6
C: base64passwdstr
S: 235 Authentication successful
C: MAIL FROM:<thisone@126.com>
S: 250 Mail OK
C: RCPT TP:<ming@xxx.com>
S: 500 Error: bad syntax
C: RCPT TO:<ming@xxx.com>
S: 250 Mail OK
S: 354 End data with <CR><LF>.<CR><LF>
C: From: "Rhett" <thisone@126.com>
C: To: "May" <yyy@126.com>
C: Date: Tue, 15 January 2016 16:02:43 +0800
C: Subject: Test message
C: Hello Alice.
C: This is a test message with 5 header fields and 4 lines in the message body.
C: Your friend,
C: Bob
C: .
S: 250 Mail OK queued as smtp6,j9KowADXC3h1DB5X3ulDCA--.35505S2 1461587193
S: Connection closed by foreign host.
2022-07-05 15:19:09 1657005549 0.025421