php-smtp服务器

php-smtp服务器,php,Php,我正在做一个项目。为此,我在ubuntu上下载了smtp服务器。请告诉我检查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 $con

我正在做一个项目。为此,我在ubuntu上下载了smtp服务器。请告诉我检查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";
}

?>

首先检查。它是否在标准SMTP端口25上侦听?(例如,
telnet localhost 25
-是否连接?)


第二张支票。日志文件怎么说?文档应该指出这些日志的位置(
/var/log
也许?

检查sudo/etc/init.d/postfix restart是否出现错误,将postfix更改为您安装的邮件服务器