I have made my website live and decided to test out my contact form, which is a simple php script I found online. It seems simple enough, but I can't figure out why I am getting the die "Error!" when I fill in all the fields and click submit on my live website. I don't have any experience working with php, so any help here would be very appreciated! PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$formcontent="From: $name \n Email: $email \n Subject: $subject \n Message: $message";
$recipient = "email@gmail.com";
$subject = "Customer Contact Message";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank you for contacting us.";
?>
HTML:
<form class="contact-form" id="contact-form" action="contactform.php" method="post">
<div class="col-md-6">
<input placeholder="Name" name="name" type="text">
</div>
<div class="col-md-6">
<input placeholder="Email" name="email" type="text">
</div>
<div class="col-md-12">
<input placeholder="Subject" name="subject" type="text">
</div>
<div class="col-md-12">
<textarea placeholder="Message" name="message"></textarea>
</div>
<div class="col-md-12">
<button class="btn submit-btn btn-primary" type="submit">Send Message</button>
</div>
</form>