以下是原始碼
<?
$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適用軟體建的~基本上沒問題,但用程式去寫好像會錯誤
這是怎嚜回事?麻煩大大了~