I have contact form on my website and works fine. I receive the mails as well.
My website is this, and here is the contact form
The only issue that I'm facing is I receive the mails easily, but I'm not able to send the revert mails to the users. I tried the php mail() function as well.
Here is my contact form page 'contact.html' :
<!DOCTYPE html>
<html>
<head>
<script language="javascript" type="text/javascript" src="master.js"></script>
<link rel="stylesheet" type="text/css" href="style1.css">
<title>welcome to peter's official website</title>
</head>
<body>
<div id = "header">
<div class="menu">
<a href="index.html">
<div class="menuitem">Home
</div>
</a>
<font size="5px" color="white">|</font>
<a href="peter.html">
<div class="menuitem">About me
</div>
</a>
<font size="5px" color="white">|</font>
<a href="contact.html">
<div class="menuitem">Contact Me
</div>
</a>
</div>
</div>
<div id="container">
<h1 class="middle-text">Contact Me</h1>
<form id="contact-form" action="mail.php" method="post">
<div>
<label>
<span>First Name<font color="red" size="4px">*</font> :</span></br>
<input name="fname" type="text" Placeholder="Your First Name" tabindex="1" required autofocus>
</label>
</div>
<div>
<label>
<span>Last Name<font color="red" size="4px">*</font> :</span></br>
<input name="lname" type="text" Placeholder="Your Last Name" tabindex="2" required>
</label>
</div>
<div>
<label>
<span>E-mail<font color="red" size="4px">*</font> :</span></br>
<input name="email" type="email" Placeholder="Your E-mail" tabindex="3" required>
</label>
</div>
<div>
<label>
<span>subject<font color="red" size="4px">*</font> :</span></br>
<input name="subject" type="text" Placeholder="Email subject" tabindex="4" required>
</label>
</div>
<div>
<label>
<span>Message<font color="red" size="4px">*</font> :</span></br>
<textarea name="message" type="text" placeholder="Your Message" tabindex="5" required></textarea>
</label>
</div>
<div>
<button name="submit" type="submit" id="contact-submit">Send Email</button>
</div>
</form>
</div>
<script src="validation-script.js"></script>
</body>
</html>
and this is 'mail.php' :
<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$formcontent="From:\n$fname $lname\n\nSubject:\n$subject\n\nMessage:\n$message \n\nEmail:\n$email";
$recipient = "contact@peterbousaada.cf";
mail($recipient,$subject, $formcontent) or header("Location:http://peterbousaada.cf/error.html");
$subject = "thank you";
$formcontent = "we have recieved your email, and we will get back to you as soon as possible";
$recipient = $email;
mail($recipient,$subject,$formcontent) or header("Location:http://peterbousaada.cf/error.html");
header("Location:http://peterbousaada.cf/thankyou.html");
?>
enter code here
just to be clear, I tried renaming the variables in second mail() function from $recipient,$subject,$formcontent to $email,$next-sub,$next-msg
Please take in consideration that I'm very new to php, so try to explain your answers thoroughly. Thanks in advance