2013-04-09 104 views
1

艱難的一天,我敢肯定我錯過了一些明顯的東西,但是有人能夠看一看這個並解釋爲什麼我會收到一封空白的電子郵件?我儘可能多的打破了這種下降儘可能,但似乎無法找到其原因空白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> 
+0

這是什麼類型的服務器?有些框沒有sendmail功能,或者需要對http.conf文件進行一些更改(如電子郵件服務器,管理員電子郵件地址等) 另外,您是否檢查過垃圾郵件文件夾? – Syndrose 2013-04-09 22:22:16

+0

快速瀏覽一切看起來不錯。你確定這些變量實際上存儲了一些東西嗎? – 2013-04-09 22:24:34

+0

'if($ sent =='0')'是什麼意思? – Mike 2013-04-09 22:26:00

回答