//The subject of the mail
$subject = "Tell a friend";
//Edit the body of the message to be sent here
$body = "Hello,<br><br>Your friend $name ($email) has recommended that you see our website $site_name. He has also sent this message along with the recommendation:<br>" . $message . "<br> Thank you,<br>-The managment";
////////////////////////////////////////////////////////////////////////////////////
// Do Not Edit Below Here Unless You Know What You Are Doing
////////////////////////////////////////////////////////////////////////////////////
if($_POST["send"] == "true") {
$to = $_POST["to"];
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
if (($name == "") OR ($email == "") OR ($message == "")) {
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">One of the fields was left blank. Please put something in all fields.</font><br><br>");
print ("</div><br>");
email_form();
}elseif(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)) {
$recipient = $to;
$subject = $the_subject;
$additional_headers = ("From: $email\n");
if(mail($recipient, $subject, $body, $additional_headers)) {
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">Error. Tell a friend script mailed your friend at $to about $site_name successfully.<br>Thank you.</font><br><br>");
print ("</div><br>");
}else{
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">Uh-Oh! Something went wrong with the script! Please try again.</font><br><br>");
print ("</div><br>");
$send = "false";
email_form();
}
}else{
print ("<div id=\"sectionContent\">");
print ("<font color=\"red\">That email address does not appear to be valid. Please try again.</font><br><br>");
print ("</div><br>");
$send = "false";
email_form();
}