谁能告诉我我的邮件表格有什么问题,尽管数据发布正确但电子邮件没有发送。为什么?

时间:2016-12-16 13:00:57

标签: php email

使用电子邮件功能提交表单:

$to = "ayush@***.com"; 
$from = $_REQUEST['email']; 
$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$message = $_REQUEST['message'];

$subject = "Form submission";

$message = $name . " " . $phone . " " .$message. " wrote the following:" . "\n\n" . $_REQUEST['message'];

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=isoo-8859-1\r\n";
$headers = "From:" . $from;

我无法发送电子邮件

mail($to,$subject,$message,$headers);

header('Location: thank-you.php');

1 个答案:

答案 0 :(得分:2)

您的上一个标题已损坏。

$headers = "From:" . $from;

它也需要点(连接)。

$headers .= "From:" . $from;

邮件被拒绝,因为没有有效的From,并且邮件被破坏了。