<?php
$subject="testmail";
$message="this is test mail from php";
$to="****@****.com";//for an example
$status=mail($to,$subject,$message);

if ($status)
{
	echo "Mail successfully Send";
}

?>

when i execute this script, it displays the following error., why this error?

mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing

Try this:

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
$headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
$headers .= "Cc: birthdayarchive@example.com\r\n";
$headers .= "Bcc: birthdaycheck@example.com\r\n";

/* and now mail it */
mail($to, $subject, $message, $headers);

or check this for your error:
http://www.w3schools.com/PHP/php_ref_mail.asp

Try this and see if it works, but you may have to modify it to reflect your form fields:

$subject="Name: ".$name."
Email: ".$email."
Message: ".$message."
";
$subject = stripslashes($subject);
mail("sales@yoursite.com","Contact Form Submitted",$subject,"From: Test mail from php");
This article has been dead for over six months. Start a new discussion instead.