$myAddress = "blah@blah.com";
// validate email address
if (ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $emailfield))
{
// address is valid
}
else
{
$returnVal = "ERROR!";
$message = ("Email Address not valid.");
echo("&message=$message&returnVal=$returnVal&");
exit;
}
// BUILD EMAIL HEADERS
$headers = "From: $namefield < $emailfield> \r\n";
// SEND EMAIL
if (mail ($myAddress, 'My Web site - form feedback' , stripslashes($commentfield), $headers)) {
$returnVal = "SUCCESS!";
$message = "Thank you for your message.";
echo("&message=$message&returnVal=$returnVal&");
}
else
{
$returnVal = "ERROR!";
$message = "Message not sent at this time";
echo("&message=$message&returnVal=$returnVal&");
}
?>
Friday, March 27, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment