Mail, endless 501 error. TCP send mail solution

First paste error messages, search engine-friendly collection, but also to the technology experience this problem friends.

smtp 501 Syntax error (no parameters allowed) (#5.5.4)

Background Description:

Uses TCP to send mail using Sina mailbox Times smtp to send mail out the error (other mailboxes may also exist with the problem), QQ mailbox without the problem.

========================================================

Send e-mail is actually very simple, we like to pursue this limit to streamline the people, certainly not willing to use third-party mail plug-ins. Use, structure, code flow, not necessarily in line with my development habits. Examples therefore you have written to send messages via TCP, source address: https: //gitee.com/coodyer/Coody-Framework/tree/original/coody-mail

 

The screenshot above is a process of sending smtp capture the situation, in fact, only need to establish a connection, then follow the above specification sends the corresponding TCP packets can be.

FIG Code (repaired) (cloud directly download the source code on the code):

 

Tencent had been using the mailbox, and then when I replace the Sina-mail, and dished out so that I am very silent errors, 501 errors endless.

smtp 501 Syntax error (no parameters allowed) (#5.5.4)

From the wrong point of view, the error code is 501, while the error is broken down 5.5.4

When checking SMTP Error Code Description of view:

501 5.5.4 Invalid Address Invalid IP address
If the receiving end mail server is MS Exchange Server 5.5, 2000, 2003 and receive this error message when, Please contact the receiving end postman attach http://support.microsoft.com/kb/291828. Will be amended Exchange Server.

Invalid IP address, I repeatedly confirmed letter of host did wrong, smtp.sina.com. Sina-mail address to view the letter, believed to be smtp.sina.com correct.

And the response message transmitted as follows:

220 smtp-2-194.smtpsmail.fmail.yf.sinanode.com ESMTP
250-smtp-2-194.smtpsmail.fmail.yf.sinanode.com 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-STARTTLS 250 8BITMIME 250 smtp-2-194.smtpsmail.fmail.www.baihua178.cn yf.sinanode.com Exception in thread "main" org.coody.framework.mail.exception.MailException: 邮件服务器初始化失败:250 smtp-2-194.smtpsmail.fmail.yf.sinanode.com at org.coody.framework.mail.sender.EmailSender.init(EmailSender.java:57) at org.coody.framework.mail.sender.EmailSender.<www.feishenbo.cn t>(EmailSender.java:34) at org.coody.framework.mail.sender.EmailSender.main(EmailSender.java:129)

So use QQ mailbox to send the message again, walkthroughs normal response content:

220 smtp.qq.com Esmtp QQ Mail Server
250 smtp.qq.com
220 Ready to start www.lafei6d.cn 334 VXNlcm5hbWU6 334 UGFzc3dvcmQ6 235 Authentication successful 250 Ok 250 Ok 354 End data with <CR><LF>.<CR><LF> 250 Ok: queued as 

Found that first line,

QQ邮箱:220 smtp.qq.com Esmtp QQ Mail Server

新浪邮箱:220 smtp-2-194.smtpsmail.fmail.yf.sinanode.com ESMTP

这是我们在建立socket连接后,发送HELO(EHLO)前服务器返回的信息。

通过测试发现,原因很简单,当我们连上socket(smtp)发信服务器后

服务器重新指定了特定的esmtp地址(或者对我们来说,叫做别名更合适吧)

故此,我们发送HELO(EHLO)时,键入的smtp,必须是服务器指定的esmtp标识

220 smtp-2-194.smtpsmail.fmail. www.qiaoheibpt.com .sinanode.com ESMTP
  
  250-smtp-2-194.smtpsmail.fmail.yf.sinanode.com
  
  250-AUTH LOGIN PLAIN
  
  250-AUTH=LOGIN PLAIN
  
  250-STARTTLS
  
  250 8BITMIME
  
  250 smtp-2-194.smtpsmail.fmail.yf.sinanode.com
  
  Exception in thread "


www.huizhonggjpt.cn

" org.coody.framework.mail.exception.MailException: 邮件服务器初始化失败:250 smtp-2-194.smtpsmail.fmail.yf.sinanode.com
  
  at org.coody.framework.mail.sender.EmailSender.init(www.jiuhuaylgw.cn EmailSender.java:57)
  
  at org.coody.framework.mail.sender.EmailSender.<init>(www.xinyueylzc.cn EmailSender.java:34)
  
  at org.coody.framework.mail.sender.EmailSender.main(www.tengyao3zc.cn EmailSender.java:129)
  
  于是使用QQ邮箱发送一遍邮件,走查正常的响应内容:
  
  220 smtp.qq.com Esmtp www.lafei6v.cn  Mail Server
  
  250 smtp.qq.com
  
  220 Ready to start TLS
  
  334 VXNlcm5hbWU6
  
  334 UGFzc3dvcmQ6
  
  235 Authentication successful
  
  250 Ok
  
  250 Ok
  
  354 End data with <CR><LF>.www.shentuylzc.cn <CR><LF>
  
  250 Ok: queued as
  

于是:

不出意外,当我们看到了 250 ok queue id 85626825952741 的响应,结果并没有太大意外。我们成功收到了邮件

 

====================================

注:鄙人并不了解邮件服务器的协议规范,纯属跟随tcp包进行模拟,如有解说不正确的地方,专业人员可指出并修改。鄙人只是苦于在网上找不到相关技术资料,故此将鄙人的解决方案记录在此,送给碰到此问题的朋友们。

Guess you like

Origin www.cnblogs.com/laobeipai/p/12116170.html