Problem in sending mail

hi,
while i am trying to send email it display error like below:

Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in C:\xampp\htdocs\stardental\feedback.php on line 45

Message delivery failed…

i am using below code to send mail.
$to = $_POST[‘email’];
$subject = “Hi!”;
$body = “We will be in touch with you. <br> Thank You !!!”;
if (mail($to, $subject, $body))
{
?>
<script type=“text/javascript”>
alert(“Mail has been sent to you. Check your mail please.”);
window.location = “feedback.php”;
</script>
<?
}
else
{
echo(“<p>Message delivery failed…</p>”);
}

the full code is given below:
<?php require_once(“includes/connection.php”); ?>
<?php require_once(“includes/functions.php”); ?>
<?php require_once(“includes/head.php”); ?>

<script type=“text/javascript”>
function first()
{
fn.innerHTML=“Invalid email”;
}

</script>

<?php
// This function tests whether the email address is valid
function isValidEmail($email){
$pattern = “[1]+(\.[_a-z0-9-]+)@[a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z]{2,3})$”;

  if (eregi($pattern, $email)){
     return true;
  }
  else {
     return false;
  }   

}
?>

<?
if(isset($_POST[‘Submit’]))
{
if($_POST[‘fname’]!=“” && $_POST[‘lname’]!=“” && $_POST[‘address’]!=“” && $_POST[‘phone’]!=“” && $_POST[‘email’]!=“” && $_POST[‘message’]!=“” )
{
if (isValidEmail($_POST[‘email’]))
{
$query=“insert into feedback(fname,lname,address,phone,email,description) values('”.$_POST[‘fname’].“‘,’”.$_POST[‘lname’].“‘,’”.$_POST[‘address’].“‘,’”.$_POST[‘phone’].“‘,’”.$_POST[‘email’].“‘,’”.$_POST[‘message’].“')”;
$result=mysql_query($query);
echo mysql_error();
?>
<script type=“text/javascript”>
alert(“FeedBack was successfully recorded !!!”);
</script>
<?
$to = $_POST[‘email’];
$subject = “Hi!”;
$body = “We will be in touch with you. <br> Thank You !!!”;
if (mail($to, $subject, $body))
{
?>
<script type=“text/javascript”>
alert(“Mail has been sent to you. Check your mail please.”);
window.location = “feedback.php”;
</script>
<?
}
else
{
echo(“<p>Message delivery failed…</p>”);
}
}
else
{
?>
<script type=“text/javascript”>
alert(“Invalid email”);
first()
</script>
<?
}
}
else
{
?>
<script type=“text/javascript”>
alert(“All fields should be fulfilled !!!”);
</script>
<?
}
}
?>
<body id=“page4”>
<div id=“site_center”>
<div class=“tall_top”>
<div class=“tall_bottom”>
<div id=“main”>
<!-- header –>
<?php require_once(“includes/header.php”); ?>
<!-- content –>
<div id=“content”>
<div class=“indent”>
<div class=“col_1”>
<div class=“indent”>
<div class=“row_2”>
<div class=“title_block”>
<div><span class=“style3”>FeedBack</span><span class=“style6”> Page</span> </div>
</div>
</div>
<form name=“form1” method=“post” action=“”>
<table width=“400” border=“0” cellspacing=“0” cellpadding=“0”>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><p>First Name:</p></td>
<td> </td>
<td><label>
<input type=“text” name=“fname” value=“<? echo $_POST[‘fname’]; ?>” /></label></td>
</tr>
<tr>
<td><p>Last Name: </p></td>
<td> </td>
<td><input type=“text” name=“lname” value=“<? echo $_POST[‘lname’]; ?>” /></td>
</tr>
<tr>
<td><p>Address:</p></td>
<td> </td>
<td><label>
<input type=“text” name=“address” value=“<? echo $_POST[‘address’]; ?>” />
</label></td>
</tr>
<tr>
<td><p>Phone:</p></td>
<td> </td>
<td><input type=“text” name=“phone” value=“<? echo $_POST[‘phone’]; ?>” /></td>
</tr>
<tr>
<td><p>Email:</p></td>
<td> </td>
<td><input type=“text” name=“email” value=“<? echo $_POST[‘email’]; ?>” /></td>
</tr>
<tr>
<td><p>Message:</p></td>
<td> </td>
<td><textarea name=“message”> <? echo $_POST[‘message’]; ?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><label>
<input type=“submit” name=“Submit” value=“Submit” />
<input type=“reset” name=“Submit2” value=“Reset” />
</label></td>
</tr>
</table>
</form>
<p align=“justify”> </p>
</div>
</div>

						&lt;?php require_once("includes/procedure.php"); ?&gt;
                        &lt;?php require_once("includes/smile.php"); ?&gt;
						&lt;div class="clear"&gt;&lt;/div&gt;
					&lt;/div&gt;
				&lt;/div&gt;
				&lt;!-- footer --&gt;
				&lt;?php require_once("includes/footer.php"); ?&gt;

  1. _a-z0-9- ↩︎

I think it is because of missing setting in your php.ini for mail send. Check the following configurations in your php.ini:


[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.myisp.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = sender@mysite.com