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