邮件确实说“发送成功”,但它不会到达。

时间:2015-01-18 02:26:38

标签: php email contact contact-form

嘿我正在使用这个PHP作为我的联系表格。 任何时候我尝试使用这个联系表格,我得到一个肯定的回复“电子邮件已被发送”,但我没有得到它。 - 不在垃圾邮件文件夹中,不在不同的邮件中。 (gmail,hotmail和yahoo测试过。) PHP:

<?php

if(empty($_POST['name'])        ||
empty($_POST['email'])      ||
empty($_POST['message'])    ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
 echo "No arguments Provided!";
 return false;
}

$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];

// create email body and send it    
$to = 'xxxx@gmail.com'; // put your email
$email_subject = "Contact form submitted by:  $name";
$email_body = "You have received a new message. \n\n".
              " Here are the details:\n \nName: $name \n ".
              "Email: $email_address\n Message \n $message";
$headers = "From: contacts@myprogrammingblog.com\n";
$headers .= "Reply-To: $email_address"; 
mail($to,$email_subject,$email_body,$headers);
return true;            
?>

0 个答案:

没有答案
相关问题