2010-10-30 164 views
0

我正在開發一個項目。爲此,我已經在Ubuntu上下載了smtp服務器。任何人都可以告訴我該命令來檢查smtp服務器是否安裝正確。因爲電子郵件沒有生成。php - smtp服務器

下面是供您參考

<?php 

ini_set('display_errors',1); 
error_reporting(E_ALL|E_STRICT); 

include('config.php'); 

// table name 
$tbl_name="temp_members_db"; 

// Random confirmation code 
$confirm_code=md5(uniqid(rand())); 

// values sent from form 
$name=$_POST['name']; 
$email=$_POST['email']; 
$country=$_POST['country']; 

// Insert data into database 
$sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')"; 
$result=mysql_query($sql); 

// if suceesfully inserted data into database, send confirmation link to email 
if($result){ 

// ---------------- SEND MAIL FORM ---------------- 

// send e-mail to ... 
$to=$email; 

// Your subject 
$subject="Your confirmation link here"; 

// From 
$header="FROM: your email"; 

// Your message 
$message="Your Comfirmation link \r\n"; 
$message.="Click on this link to activate your account \r\n"; 
//$message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code"; 
$message.="http://localhost/confirmation.php?passkey=$confirm_code"; 

// send email 
$sentmail = mail($to,$subject,$message,$header); 

} 

// if not found 
else { 
echo "Not found your email in our database"; 
} 

// if your email succesfully sent 
if($sentmail){ 
echo "Your Confirmation link Has Been Sent To Your Email Address."; 
} 
else { 
echo "Cannot send Confirmation link to your e-mail address"; 
} 

?> 

回答

0

首先檢查的代碼。它是否在標準的SMTP端口25上收聽? (例如telnet localhost 25 - 這是否連接?)

第二次檢查。日誌文件說什麼?該文檔應該指出這些日誌的位置(/var/log也許?)

+0

如何檢查... – AON 2010-10-30 15:23:30

0

檢查sudo /etc/init.d/postfix restart是否給出錯誤,將postfix更改爲您安裝的郵件服務器。