我有一個contact.html表單,它將字段提交給contact.php腳本;但是,我沒有收到我的收件箱中的電子郵件。是的:電子郵件地址是正確的。這裏的地址給form web page 這裏是爲contact.php沒有從我的php聯繫表格中收到電子郵件
<?php
$my_email = "[email protected]";
$final_msg = "";
//validation function
function validate($data) {
$data = trim($data); //removing white space and tabs
$data = stripslashes($data); //removing \
$data = htmlspecialchars($data); //converting to html
return $data;
}
if($_SERVER['REQUEST_METHOD'] == "POST") {
$name = validate($_POST["name"]);
$email = validate($_POST["email"]);
$subject = validate($_POST["subject"]);
$message = validate($_POST["message"]);
}
$final_msg += "name: " . $name . "\n" .
"email: " . $email . "\n" .
"subject: " . $subject . "\n" .
"message: ". $message;
$headers = "From: [email protected] \r\n" . "Reply-To: " . $email . "\r\n";
if(mail($my_email, $subject, $final_msg, $headers)) {
echo "<b>Your Message Was Successfuly Sent!... Thanks</b>" . "<br>";
echo "<b>name: </b>" . $name . "<br>";
echo "<b>email: </b>" . $email . "<br>";
echo "<b>subject: </b>" . $subject . "<br>";
echo "<b>message: </b>" . $message;
}
else {
echo "<b>Your Message Could not be Sent!... Sorry</b>";
}
?>
任何錯誤消息insteda? – panther
是的,知道這是如何失敗將是有益的。如果還不能將PHP設置爲冗長並更新您的文章W /一些診斷信息? – metaColin
我主要用Java編程,所以我不是在瀏覽器上調試的專家,我只是開始瞭解javscript/php。我怎麼能啓用PHP詳細?...意思是,當我正在尋找答案 – miatech