0
使用电子邮件功能提交表单:任何人都可以告诉我什么是我的邮件表单错误,虽然数据正确发布但电子邮件没有发送。为什么?
$to = "[email protected]***.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');
mail()函数并不总是足以在所有托管提供程序中发送邮件。尝试SMTP或PHPMailer。 – Bhavin
并使用'$ _POST'而不是'$ _REQUEST'。请求包含GET,POST和COOKIE,所以您不能确定数据是否来自帖子。 – Twinfriends