我想在widows上使用php聯繫表單asp.net託管包,php已啓用,但仍然是我的表單不發送電子郵件,它正在引導到error.html頁面.... ..在Windows上的PHP聯繫窗體託管錯誤
這裏是代碼
<?php
$EmailFrom = "anksaltlamps.com";
$EmailTo = "[email protected]";
$Subject = "Website Query";
$Name = "Not Specified";
$Tel= "Not Specified";
$City= "Not Specified";
$Country= "Not Specified";
$Other= "Not Specified";
$Address= "Not Specified";
$Message= "Not Specified";
$State= "Not Specified";
$Name = Trim(stripslashes($_POST['Name']));
$Tel = Trim(stripslashes($_POST['Tel']));
$Email = Trim(stripslashes($_POST['Email']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Country = Trim(stripslashes($_POST['Country']));
$Other = Trim(stripslashes($_POST['Other']));
$Address = Trim(stripslashes($_POST['Address']));
$Message = Trim(stripslashes($_POST['Message']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State/Province: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Country: ";
$Body .= $Country;
$Body .= "\n";
$Body .= "Other Country: ";
$Body .= $Other;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
ini_set('sendmail_from', '[email protected]');
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
,或者你通過這個鏈接
什麼是php.ini中的SMTP和smtp_port郵件設置 – 2010-08-12 13:51:30
您是否在php.ini中編輯郵件配置? – 2010-08-12 13:52:05