|
Please fill out the form and then click on the submit button.";
}
elseif (($Name == "") || ($Comments == ""))
{
$ask = 1;
echo " You missed some field. ";
}
if ($ask == 1)
{
echo "Please fill in all the fields, so we can get back to you... ";
echo "";
}
else
{
$message = "Name: $Name\nEmail: $Email\nComments: $Comments\n";
$eLog="/tmp/mailError.log";
//Get the size of the error log
//ensure it exists, create it if it doesn't
$fh= fopen($eLog, "a+");
fclose($fh);
$originalsize = filesize($eLog);
if (preg_match('/^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]{2,4}$/', $Email, $matches)) {
print ("Sending to owner (cc: to you) -- br> br>");
mail ($to, "Website Email", $message, "Cc:$Email");
} else {
print ("Sending to owner -- br> br>");
mail ($to, "Website Email", $message);
}
/*
* NOTE: PHP caches file status so we need to clear
* that cache so we can get the current file size
*/
clearstatcache();
$finalsize = filesize($eLog);
//Check if the error log was just updated
if ($originalsize != $finalsize) {
print "There was a problem sending the mail. Please try again later or send the message to$to using your own mail client progam. ";
} else {
echo "Thanks for your message, $Name. ";
}
}
?>
|