无法从联系表单发送消息

时间:2019-01-02 18:08:23

标签: php html contact-form

当我尝试发送消息时,我的联系表不起作用。我不是后端开发人员,所以无法解决问题。我的文件在我的托管服务器中。所以任何人都可以告诉我我在做什么错。

HTML

<form action="contact-form.php" method="post" name="contact-form" autocomplete="off">
    <input type="text" placeholder="Your Name" name="name">
    <input type="text" placeholder="Your Email" name="email">
    <input type="Message" placeholder="Message" name="message">
    <input type="submit" value="Send" name="submit">
</form>

PHP

<?php 
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "salmanbinhilabi@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>

0 个答案:

没有答案