// contact mail script
// recipient array
$recipient[1] = "webmaster@www.yourdomain.tld";
$recipient[2] = "sales@www.yourdomain.tld";
$recipient[3] = "service@www.yourdomain.tld";
// was there any of the REQUIRED input?
if ($comments= ="")
{
// no comments so better send them back
echo "Comments are required.
";
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 = $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;
// and send the comments off to the webmaster
mail(