艰难的一天,我敢肯定我错过了一些明显的东西,但是有人能够看一看这个并解释为什么我会收到一封空白的电子邮件?我尽可能多的打破了这种下降尽可能,但似乎无法找到其原因空白php - 电子邮件形式
<?php
$to = '[email protected]';
$name = $_POST['name'] ;
$subject = "Message from: $name";
$message = $_POST['comment'] ;
$robotest = $_REQUEST['robotest'];
$body = "From: $name \r\nMessage: $message";
/*
if (preg_match($match, $from) ||
preg_match($match, $subject) ||
preg_match($match, $body)) {
die("Header injection detected.");
}
*/
if ($sent == '0') {
mail($to, $subject, $body) or die("Error Bro!!!");
$sent = 1;
}
if ($robotest) {
$error = print("You are a gutless robot.");
}
if ($name == ' '){
print("You have not entered a name, please go back and try again");
} else {
$send = mail($to, $subject, $body);
print("Thank you for contacting us. We will be in touch with you very soon.");
}
?>
HTML的原因:
<form style="margin-left: 10%;" method="post" action="coming-soon/email.php" enctype="text/plain">
<br>
<input id="fName" name="name" type="text" placeholder="Name (required)"><br><br>
<p class="robotic" id="pot">
<label>If you're human leave this blank:</label>
<input name="robotest" type="text" id="robotest" class="robotest" />
</p>
<textarea id="fComment" name="comment" style="height: inherit; margin: 0 40% 1% 0;" rows="10" cols="50" placeholder="Place your Message here...."></textarea>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
这是什么类型的服务器?有些框没有sendmail功能,或者需要对http.conf文件进行一些更改(如电子邮件服务器,管理员电子邮件地址等) 另外,您是否检查过垃圾邮件文件夹? – Syndrose 2013-04-09 22:22:16
快速浏览一切看起来不错。你确定这些变量实际上存储了一些东西吗? – 2013-04-09 22:24:34
'if($ sent =='0')'是什么意思? – Mike 2013-04-09 22:26:00