Here is all code of mine.
<?php
$p =& $POST;
if (count ($p) > 0 )
{
// get posted data into local variables
$EmailTo = "info@mcc.com.np";
$Name = Trim(stripslashes($POST['name']));
$Email = Trim(stripslashes($POST['email']));
$Address = Trim(stripslashes($POST['address']));
$Feedback = Trim(stripslashes($_POST['feedback']));
$Subject = "$Name has just send feedback";
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Feedback: ";
$Body .= $Feedback;
$Body .= "\n";
$Body .= "IP Address: ";
$Body .= $_SERVER['REMOTE_ADDR'];
$Body .= "\n";
// Auto Replying
$ReplySubject = "Re: Feedback for mcc.com.np" ;
$Reply = " ";
$Reply .= "\n";
$Reply .= "====================================================";
$Reply .= "\n";
$Reply .= "THIS IS NOTIFICATION ONLY. DONOT REPLY THIS MESSAGE.";
$Reply .= "\n";
$Reply .= "====================================================";
$Reply .= "\n";
$Reply .= "\n";
$Reply .= "Dear $Name";
$Reply .= "\n";
$Reply .= "\n";
$Reply .= "Your feedback has been successfully send to Matatirtha Computer Company Pvt. Ltd." ;
$Reply .= "\n";
$Reply .= "http://www.mcc.com.np";
$Reply .= "\n";
$Reply .= "Thanks for submitting feedback" ;
$Reply .= "\n";
$Reply .= "\n";
$Reply .= "\n";
$Reply .= "__________________________________________";
$Reply .= "\n";
$Reply .= "Matatirtha Computer Company Pvt. Ltd.";
$Reply .= "\n";
$Reply .= "Matatirtha VDC Ward No.2, Gairi Gaun";
$Reply .= "\n";
$Reply .= "Kathmandu, NEPAL";
$Reply .= "\n";
$Reply .= "Email : info@mcc.com.np";
$Reply .= "\n";
$Reply .= "http://www.mcc.com.np";
$Reply .= "\n";
//checking for not send email twice
if (!isset($_SESSION['mailsent']))
{
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
// send confirmation
mail($Email, $ReplySubject, $Reply, "From: <$Email>");
?>
<p align="center"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<br>
<br>
<br>
Dear <font color="#CC0033">
<?php print "$Name" ?></font>, thank you for submitting your valuable feedback.
<br>
We will inform you as soon as possible. </font></b>
<?php
}
else
{
?>
<p align="center"><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<br>
<br>
<br>
<br>
Dear <font color="#CC0033">
<?php print "$Name" ?></font>, some error occured while submitting your feedback.
<br>
<a href="javascript:history.back()">Please try again</a>
</font></b>
<?php
}
$_SESSION['mailsent'] = true;
}
else
{
echo "Your mail was already sent. Please do not press the refresh button again.";
}
}
else
{
?>
<form name="form" action="<?php print $_SERVER['REQUEST_URI']; ?>" method="POST" onsubmit="return formCheck(this)">
<div align="center">
<table width="98%" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0">
<tr valign="middle" bgcolor="#5F8A2F">
<td height="20" colspan="2" class="header1" style="border-style: none; border-width: medium">
<p align="center" class="title"> <font color="#FFFFFF" size="2"><strong>Feedback</strong></font></td>
</tr>
<tr>
<td class="menutxt" style="border-style: none; border-width: medium"> </td>
<td style="border-style: none; border-width: medium"> </td>
</tr>
<tr>
<td width="101" class="menutxt" style="border-style: none; border-width: medium">
<font face="Verdana"> Name:</font></td>
<td width="370" style="border-style: none; border-width: medium"> <font face="Verdana">
<input type="text" name="name" size="34" style="font-family: Verdana; font-size: 10pt">
</font></td>
</tr>
<tr>
<td width="101" class="menutxt" style="border-style: none; border-width: medium">
<font face="Verdana">Email :</font></td>
<td width="370" style="border-style: none; border-width: medium"> <font face="Verdana">
<input type="text" name="email" size="34" style="font-family: Verdana; font-size: 10pt">
<font color="#FF0066" size="1">valid only</font></font></td>
</tr>
<tr>
<td width="101" class="menutxt" style="border-style: none; border-width: medium">
<font face="Verdana">Address :</font></td>
<td width="370" style="border-style: none; border-width: medium"> <font face="Verdana">
<input type="text" name="address" size="20" style="font-family: Verdana; font-size: 10pt">
</font></td>
</tr>
<tr>
<td width="101" valign="top" class="menutxt" style="border-style: none; border-width: medium">
<font face="Verdana">Feedback</font></td>
<td width="370" bgcolor="#EAEAEA" style="border-style: none; border-width: medium">
<font face="Verdana">
<textarea rows="8" name="feedback" cols="50" style="font-family: Verdana; font-size: 10pt"></textarea>
</font></td>
</tr>
<tr>
<td height="24" colspan="2" style="border-style: none; border-width: medium">
<p align="center"> <font face="Verdana">
<input name="submit" type="submit" value="Submit">
<input name="reset" type="reset" value="Reset">
<font size="2">
<SCRIPT language="JavaScript">
<!--
function formCheck() {
//if (form.terms.value=='no')
//{alert("Please read out the terms and conditions first");return false;}
if (form.name.value == "")
{alert("Please enter your name");
form.name.focus();return false;}
if (form.email.value == "")
{alert("Please enter your Email Address");
form.email.focus();return false;}
if ((form.email.value.indexOf("@") < 2))
{alert("Incorrect Email Address");
form.email.focus();return false;}
if (form.feedback.value=="")
{alert("Please provide your feedback");
form.feedback.focus();return false;}
}
// -->
</SCRIPT>
</font></font> </td>
</tr>
</table>
</div>
</form>
<?php } ?>