我正在尝试制作一个无验证码、阻止垃圾邮件的联系表格。从用户的角度来看,它似乎在工作,因为在单击发送按钮后会出现感谢页面。
问题 #1:到达的电子邮件是空白的,不包含已发送消息的任何内容。在这里找到一个听起来相似的帖子,但提供的建议不适用: 联系表格问题 - 我确实收到了消息,但没有内容(空白页)。
问题#2:回复消息也显示在同一个收件箱中,而不是发送到表单用户的地址——在测试时,它是我自己的。
的HTML:
<form method="post" action="submit.php">
<p>Name:<br>
<input type="text" name="Name" id="Name" /></p>
<p>Phone:<br>
<input type="text" name="Phone" id="Phone" /></p>
<p>Email:<br>
<input type="text" name="Email" id="Email" /></p>
<p class="antispam">Leave this empty:<br />
<input name="url" /></p>
<p style="color:#06C;">Forward to:<br>
<input type="text" name="Forwardto" id="Forwardto" /></p>
<p>Message:<br />
<textarea name="Message" rows="20" cols="20" id="Message"></textarea></p>
<p><input type="submit" value="Send" class="submit-button" /></p>
</form>
PHP(删除了我的实际地址):
<?php
if(isset($_POST['url']) && $_POST['url'] == ''){
$youremail = '----@----.com';
$body = "This is the form that was just submitted:
Name: $_POST[name]
Phone: $_POST[phone]
E-Mail: $_POST[email]
Forward to: $_POST[forwardto]
Message: $_POST[message]";
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
mail($youremail, 'Contact Form', $body, $headers );
}
?>
相关的CSS:
<style type="text/css">
.antispam { display:none;}
</style>
是上面代码的问题。. . 还是可能发生其他事情?