简体   繁体   English

Windows托管上的PHP联系人表格错误

[英]php contact form on windows hosting error

I am trying to use a php contact form on widows asp.net hosting package, php is enabled but still my form is not sending email it is directing to error.html page...... 我正在尝试在widows asp.net托管程序包上使用php联系人表单,启用了php,但我的表单仍未发送电子邮件,它直接指向error.html页面……

here is the code 这是代码

<?php

$EmailFrom = "anksaltlamps.com";
$EmailTo = "support@anksaltlamps.com";
$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', 'support@anksaltlamps.com');
// 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\">";
}
?>

or you check it online by this link 或者您通过此链接在线检查

link text 连结文字

Read this . 阅读此 This is probably due to your mail settings in php.ini. 这可能是由于您在php.ini中设置了邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM