现在的发送信息为:
CONNECTING 202.205.161.3 ...Succeed!
RESPONSE: 220 mail.crtvu.edu.cn Microsoft ESMTP MAIL Service, Version: 5.0.2195.5329 ready at Wed, 11 Jun 2003 16:16:06 +0800
CWD: HELO
RESPONSE: 250 mail.crtvu.edu.cn Hello [202.205.161.99]
CWD: AUTH LOGIN
RESPONSE: 503 5.5.2 Send hello first.
CWD: bGl1dA==
RESPONSE: 500 5.3.3 Unrecognized command
CWD: MjUxOTEz
RESPONSE: 500 5.3.3 Unrecognized command
CWD: MAIL FROM: [email protected]
RESPONSE: 250 2.1.0 [email protected] OK
SMTP Protocol failure (250 2.1.0 [email protected] OK ).
但收不到邮件!
RESPONSE: 500 5.3.3 Unrecognized command 是怎么个意思?
CONNECTING 202.205.161.3 ...Succeed!
RESPONSE: 220 mail.crtvu.edu.cn Microsoft ESMTP MAIL Service, Version: 5.0.2195.5329 ready at Wed, 11 Jun 2003 16:16:06 +0800
CWD: HELO
RESPONSE: 250 mail.crtvu.edu.cn Hello [202.205.161.99]
CWD: AUTH LOGIN
RESPONSE: 503 5.5.2 Send hello first.
CWD: bGl1dA==
RESPONSE: 500 5.3.3 Unrecognized command
CWD: MjUxOTEz
RESPONSE: 500 5.3.3 Unrecognized command
CWD: MAIL FROM: [email protected]
RESPONSE: 250 2.1.0 [email protected] OK
SMTP Protocol failure (250 2.1.0 [email protected] OK ).
但收不到邮件!
RESPONSE: 500 5.3.3 Unrecognized command 是怎么个意思?
另外对方也可能使用其它编码方式发送用户名或密码,给我一个用户名密码?
at Wed, 11 Jun 2003 18:32:11 +0800
250-mail.crtvu.edu.cn Hello [61.149.53.153]
250-TURN
250-ATRN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
500 5.3.3 Unrecognized command
334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
535 5.7.3 Authentication unsuccessful.
目前smtp转发都需要用户名和密码验证,很烦很烦的
不如直接发到对方信箱所在的服务器
我搞了一天终于弄明白其中的奥秘
不需smtp转寄 则你要知道对方的服务器地址
例如 [email protected] 要知道abc.com主机的邮件主机ip
要得到此ip需要得到abc.com这个域的mx纪录,mx记录了邮件服务器的地址
通常有好几个,备用
选择其中一个能用的发信过去就可以了,这个时候是绝对不会来问你密码的
得到mx记录的php函数是getmxrr(),不过windows下没有这个函数
用nslookup能得到mx纪录,不过是外部命令
linux下没有问题,win32下要调用exec()来执行nslookup -type=mx abc.com. 来查询mx
具体程序还没有
不过我用telnet发信成功,相信用php的socket也没问题
{ //auth login
fputs($smtp,"AUTH LOGIN\r\n"); $line = fgets($smtp, 1024);
//echo "auth_login".$line;
$this->sessionlog .= "Rcvd: $line"; $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] = substr($line, 0, 1); $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULTTXT'] = substr($line, 0, 1024); //334
if ($SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] <> '3') return new Exception($html_smtp_error_unexpected." ".$line); //user 以base64编码发送用户名和密码 //echo "smtp_user".$this->smtp_user;
//echo "smtp_pass".$this->smtp_pass; fputs($smtp,base64_encode($this->smtp_user)."\r\n"); $line = fgets($smtp, 1024);
//echo "user:".$line; $this->sessionlog .= "Rcvd: $line"; $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] = substr($line, 0, 1); $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULTTXT'] = substr($line, 0, 1024); //334
if ($SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] <> '3') return new Exception($html_smtp_error_unexpected." ".$line); //pass
fputs($smtp,base64_encode($this->smtp_pass)."\r\n");
//fputs($smtp,"PASS $this->smtp_pass\r\n"); $line = fgets($smtp, 1024); //echo "pass:".$line; $this->sessionlog .= "Rcvd: $line"; $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] = substr($line, 0, 1); $SMTP_GLOBAL_STATUS[$smtp]['LASTRESULTTXT'] = substr($line, 0, 1024); //235 Authtication successful
if ($SMTP_GLOBAL_STATUS[$smtp]['LASTRESULT'] <> '2') return new Exception($html_smtp_error_unexpected." ".$line);
return (true);
}
{ //auth login
fputs($smtp,"AUTH LOGIN\r\n"); $line = fgets($smtp, 1024);
echo "auth_login".$line; //user 以base64编码发送用户名和密码 //echo "smtp_user".$this->smtp_user;
//echo "smtp_pass".$this->smtp_pass; fputs($smtp,base64_encode($this->smtp_user)."\r\n"); $line = fgets($smtp, 1024);
echo "user:".$line; //password
fputs($smtp,base64_encode($this->smtp_pass)."\r\n");
$line = fgets($smtp, 1024); echo "pass:".$line; return (true);}