php-电子邮件表单

php-电子邮件表单,php,forms,email,Php,Forms,Email,这是一个艰难的日子,我肯定我错过了一些明显的东西,但有人能看一下这个,解释一下为什么我收到一封空白的电子邮件吗?我已经尽可能地把它分解了,但似乎找不到它空白的原因 <?php $to = 'blah@blah.com'; $name = $_POST['name'] ; $subject = "Message from: $name"; $message = $_POST['comment'] ; $robotest = $_REQUEST['robotest']; $body = "Fr

这是一个艰难的日子,我肯定我错过了一些明显的东西,但有人能看一下这个,解释一下为什么我收到一封空白的电子邮件吗?我已经尽可能地把它分解了,但似乎找不到它空白的原因

<?php
$to = 'blah@blah.com';
$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:


删除,它应该工作。也来看看这里


这是什么类型的服务器?有些邮箱没有sendmail功能,或者需要您对http.conf文件进行一些更改,如电子邮件服务器、管理员电子邮件地址等。此外,您是否检查了junkmail文件夹?快速浏览一下,一切都正常。你确定这些变量中确实存储了一些东西吗?如果$sent='0',@syndrome电子邮件正在发送,但电子邮件中的字段返回空白,这有什么意义呢?@350_Design这些变量应该是从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>
 enctype="text/plain"