session_start(); // Has the form been submitted? If not skip to the HTML if( isset($_POST['submit'])) { // Check if the security code matched the image. if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { //If the security code was entered correctly process the form $mailto = "woodciti@gmail.com"; $subject = $_POST['subject']; $redirect = $_POST['redirect']; $email = $_POST['email']; foreach($HTTP_POST_VARS as $key => $value) { if ($key == "subject") { echo ""; } else if ($key == "redirect") { echo ""; } else if ($key == "submit") { echo ""; } else if($key == "security_code") { echo ""; } else { $message .= ''.$key . ': ' . $value; $message .= "\n"; //Note the double quotes } } if (@mail($mailto, $subject, $message, "From:links@woodroyal.com")) { header("Location: $redirect"); unset($_SESSION['security_code']); } else { // This echo's the error message if the email did not send. // You could change the text in between the
tags. echo('
Mail could not be sent. Please use your back button to try again.
'); } } } ?>