"; echo "click to go back"; exit; } else { //the e-mail address of whomever was chosen in the form is ... $mail_to = $recipient[$_POST['whofor']]; $mail_from = "From: Form robot at www.yourdomain.tld"; $mail_subject = $_POST['subject']; // start building the content of the message $mail_body = "You have received a posting from your contact form. The visitor - "; // who sent this?? if ($_POST['visitor_name'] != "") { $sender = $_POST['visitor_name']; } else { $sender = "anonymous"; } $mail_body.= $sender. " - "; // what e-mail?? if ($_POST['visitor_email'] != "") { $emailer = "used ". $_POST['visitor_email']. " as their e-mail address"; } else { $emailer = "gave no e-mail address"; } $mail_body.= $emailer. ".\n\n"; // get the IP address and time sent $ip = getenv("REMOTE_ADDR"); $when = gmdate("h:i a"). " [GMT] on ". gmdate("F d Y"); $mail_body.= "The message was sent at ". $when. "from the IP address ". $ip. ".\n\n"; // clean up the message comments $comments = stripslashes(strip_tags($_POST['comments'])); $mail_body.= "The message was as follows:\n\n". $comments. \n\n; $mail_body.= "===============================\nAutomated message - do not reply\n==============================="; // and send the comments off to the webmaster mail("$mail_to","$mail_subject","$mail_body","$mail_from"); // either include your own thank-you page using syntax like // include("thank-you.html"); // or just add html right here using syntax like // echo "

Your message has been sent

"; } ?>