就當我按提交的電子郵件網站,它現在一切正常,但我沒有收到電子郵件,有人請幫助?
PHP
<?php
$first_name = $_POST ['first_name'];
$last_name = $_POST ['last_name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = "From:" . $first_name . $last_name;
$to = "[email protected]";
$subject = "New Message";
print_r($_POST);
mail ($to, $subject, $message, $headers);
echo "Your Message has been sent";
?>
HTML
<form action="contact.php" name="contact_form" method="post">
<p>
First name:
<input name="first_name" type="text"/>
</p>
<p>
Last name:
<input name="last_name" type="text"/>
</p>
<p>
<br>
E-Mail:
<input name="email" type="text"/>
</p>
<br>
<p>Type your enquiry</p>
<p><textarea name"message"></textarea></p>
<p>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset">
</p>
</form>
舊錯誤消息+數據它被髮送(第二圖片)
'From:'標題應該包含地址,而不是名稱。 – Barmar
缺少分號 – Musa
爲什麼你迴應說郵件沒有檢查mail()的返回值? – Barmar