我的表单每隔一段时间就会从我的主人那里发送空白邮件(www@servage-customer.net
)
这是我的代码:
<?php
$email_id="email@example.com";
$userName=$_REQUEST['userName'];
$userEmail=$_REQUEST['userEmail'];
$userPhone=$_REQUEST['userPhone'];
$userMsg=$_REQUEST['userMsg'];
$subject = "Bericht van ".$userName;
$message = '<html><head><title>'.$subject.'</title></head><body><table><tr><td>Email : </td><td> '.$userEmail.'</td></tr><td><tr>Telefoonnummer</tr></td><td><tr> '.$userPhone.'</tr></td>
<tr><td>Naam : </td><td> '.$userName.'</td></tr><tr><td>Bericht : </td><td> '.$userMsg.'</td>
</tr></table></body></html>';
//$message = "Email: ".$userEmail. "\r\nNaam: ".$userName."\r\nBericht : ".$userMsg;
$to=$email_id;
$headers = "From: " . strip_tags($userEmail) . "\r\n";
$headers .= "Reply-To: ". strip_tags($userEmail) . "\r\n";
//$headers .= "CC: email@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if(!mail($to, $subject, $message, $headers)){
$mail_status='no';
header("Location: index.html");
exit();
}else{
$mail_status='yes';
header("Location: contact.html");
exit();
} ?>
我真的不知道自己做错了什么。
答案 0 :(得分:2)
代码工作正常,问题可能是您直接访问.php文件,该文件发送空白邮件。