以下是原始码
<?
$smtp_acc ="chris"; //Smtp认证的用户名
$smtp_pass="666"; //Smtp认证的密码,一般等同pop3密码
$smtp_host="61.62.*.*"; //SMTP伺服器位址,类似 smtp.tom.com
$lb="\r\n"; //linebreak
$smtp = array(
//2、发送Auth Login,期待返回334
array("AUTH LOGIN".$lb,"334","AUTH error:"),
//3、发送经过Base64编码的用户名,期待返回334
array(base64_encode($smtp_acc).$lb,"334","AUTHENTIFICATION error : "),
//4、发送经过Base64编码的密码,期待返回235
array(base64_encode($smtp_pass).$lb,"235","AUTHENTIFICATION error : "));
//打开smtp伺服器端口
$fp = @fsockopen($smtp_host, 25);
if (!$fp) echo "<b>Error:</b> Cannot conect to ".$smtp_host."<br>";
while($result = @fgets($fp, 1024)){if(substr($result,3,1) == " ") { break; }}
$result_str="";
//发送smtp数组中的命令/数据
foreach($smtp as $req){
//发送讯息
@fputs($fp, $req[0]);
//如果需要接收伺服器返回讯息,则
if($req[1]){
//接收讯息
while($result = @fgets($fp, 1024)){
if(substr($result,3,1) == " ") {break;}
}
if (!strstr($req[1],substr($result,0,3))){
$result_str.=$req[2].$result."<br>";
}
}
}
//关闭连接
@fclose($fp);
if(!$result_str){
$mailtype='Content-Type:text/html;charset=big5'
$mailFrom='webmaster@61.62.73.210'
$mailTo=$row_RecMember['m_email'];
$mailCC=''
$mailBCC=''
$mailSubject='会员系统密码认证信'
$mailContent = nl2br($row_RecMember['m_nick'].'您好,您的密码为:'.$row_RecMember['m_passwd']);
$maildata = "From:$mailFrom\r\n";
if ($mailCC != '') {
$maildata .= "CC:$mailCC\r\n";
}
if ($mailBCC != '') {
$maildata .= "BCC:$mailBCC\r\n";
}
$maildata .= "$mailtype";
mail($mailTo,$mailSubject,$mailContent,$maildata);
}else{
echo "错误讯息<br>" . $result_str;
}
?>
执行完之后~~出现错误讯息
AUTH error:502 Unknown command
AUTHENTIFICATION error : 502 Unknown command
AUTHENTIFICATION error : 502 Unknown command
这样是不是认证错误阿~~ㄚ我快疯了~~写程式好难喔~~
我的MAIL SERVER适用软体建的~基本上没问题,但用程式去写好像会错误
这是怎嚜回事?麻烦大大了~