使用电子邮件功能提交表单:
$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');
答案 0 :(得分:2)
您的上一个标题已损坏。
$headers = "From:" . $from;
它也需要点(连接)。
$headers .= "From:" . $from;
邮件被拒绝,因为没有有效的From
,并且邮件被破坏了。