我正在制作联系表格,但是当请求联系人的电子邮件是@gmail,@ hotmail,@ msn以及其他更多内容时,电子邮件不会发送给网站管理员。
这是我的代码:
//FROM CONTACTFORM:
$subject = $_POST['subject'];
$message = $_POST['message'];
$name = $_POST['name'];
$email = $_POST['email']; //If this is gmail, hotmail it won't sent.
//This is sent to the webmaster so he can answer:
$to = 'webmaster@mysite.com';
$headers = 'From: Mysite.com <webmaster@mysite.com>' . "\r\n";
$headers .= 'To: '. $to . "\r\n";
$headers .= 'Reply-To: '.$email . "\r\n"; //This is where it goes wrong
$headers .= 'Content-Type: text/html; charset="UTF-8"' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$mailSubject = '[Contactform] - '.$subject.'';
$mailContent = 'MyMessage';
if(!mail($to, $mailSubject, $mailContent, $headers)) {
echo 'Mail not sent';
}
回复不能是@hotmail,@ gmail或@msn,因为它不会发送,我会收到邮件未发送的信息。在这种情况下。 有人可以帮帮我吗?