<?php
// get posted data into local variables
$From = Trim(stripslashes($_POST['From']));
$Subject = Trim(stripslashes($_POST['Subject']));
$Body = Trim(stripslashes($_POST['Body']));
// validation
$validationOK=true;
if (Trim($From)=="") $validationOK=false;
if (Trim($Body)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Body: ";
$Body .= $Body;
$Body .= "\n";
// send email
$success = mail("jptemp2001@yahoo.com", $Subject, $Body, "From: <$From>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php\">";
}
?>