日期:2014-05-18  浏览次数:20740 次

SMTP客户端报354错误不知怎么解决,请高人指点
小弟写了一个SMTP客户端发送邮,但是报345错误,
客户端日志为:
init   SNMP   Client   ................
send:HELO   hnzpabc
receive:220   localhost   Winmail   Mail   Server   ESMTP   ready
send:MAIL   FROM:yuto@servicemail.com
receive:250   localhost   Winmail   Mail   Server
send:RCPT   TO:hnzpabc@servicemail.com
receive:250   ok
send:DATA
receive:250   ok
send:From:yuto@servicemail.com
receive:354   go   ahead,   end   data   with   CRLF.CRLF

winmail日志为:
2007/06/13-22:21:27       2560   Connect   from   192.168.0.21
2007/06/13-22:21:27       2560   remote   helo   =   hnzpabc
2007/06/13-22:21:27       2560   remote   sent   'mail   from '   =   FROM:yuto@servicemail.com
2007/06/13-22:21:27       2560   mail   from   =   yuto@servicemail.com
2007/06/13-22:21:27       2560   remote   sent   'rcpt   to '   =   TO:hnzpabc@servicemail.com
2007/06/13-22:21:27       2560   rcpt   to   =   hnzpabc@servicemail.com
2007/06/13-22:21:27       2560   smtp   data
2007/06/13-22:21:27       2560   go   ahead,   end   data   with   CRLF.CRLF

我认为是发送邮件内容格式不对但不知怎样改!!!
邮件内容格式为:
from:yuto@servicemail.com
to:hnzpabc@servicemail.com
date:Wed   Jun   13   22:26:53   CST   2007


------解决方案--------------------
smpt客户端得遵循smtp协议
当客户端发送data指令后,服务器回复250 ok指令,这个时候,服务器端就会准备接受邮件正文了
smtp协议中,正文以 '. '结束

服务器发送354 go ahead, end data with CRLF.CRLF
可能是因为客户端上发送的send:From:yuto@servicemail.com格式不对
楼主仔细查看一下关于smpt邮件协议的指令就会清楚了