I am trying to send emails through my HTML site using PHP, but unfortunately, it is not working.
What is the actual problem? Please can anybody help?>
This is my HTML code:
<form action="contact.php" method="POST">
<input class="form-control form-control-lg" name="name" id="name" type="text" placeholder="Your Name*" required aria-label=".form-control-lg example">
<input class="form-control form-control-lg" name="phone" id="phone" type="number" placeholder="Your Phone No" aria-label=".form-control-lg example">
<input class="form-control form-control-lg" name="email" id="email" type="email" placeholder="Your Email*" required aria-label=".form-control-lg example">
<textarea class="form-control pt-4" name="message" id="message" placeholder="Your Message" rows="3"></textarea>
<div class="btn_group">
<button type="submit" class="btn olive">Send Mail</button>
</div>
and my PHP code:
<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent="From: $name n Message: $message n Phone: $phone";
$recipient = "[email protected]";
$mailheader = "From: $email rn";
mail($recipient, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>