$error
Enter Name:

E-mail Address:

Subject:

Enter Message:


\n"); } // *** END function printmailform *** // *** function to verify e-mail address *** // Checks both format of address and that MX record exists. function checkemail ($email) { // First make sure the format of the e-mail address is okay. // We check things like at least one valid character on either // side of a period, only one @ sign, top-level domain names // have at least two characters. if ( eregi("^[_0-9a-z-]([_\.0-9a-z-])*@([0-9a-z][_0-9a-z-]+\.)+([0-9a-z][_0-9a-z-]+\.)*([a-z]{2,}$)", $email, $check) ) { // If the format is okay, make sure there's an MX record for this domain. if ( getmxrr(substr(strstr($check[0], '@'), 1), $mxhosts) ) { // Found an MX record -- return empty error string. return ""; } // No MX record -- return error. return "This e-mail address appears to be invalid (bad MX).
Please supply a valid e-mail address."; } else { // Bad format -- return error. return "This e-mail address appears to be invalid (bad format).
Please supply a valid e-mail address."; } } // *** END function checkemail *** // *** function to send e-mail with content of form *** // Also displays back to user what was sent. function sendmailform($from,$subject,$body,$trailer) { global $subjects; global $categories; global $thissite; global $returnto; global $returntoname; global $billing_addressee; // added by phil global $realname; global $sitename; global $siteurl; global $reciprocal; // if ( eregi("billing",$subject) ) { // Send to BHE-Bill if subject billing. // $sendto = $billing_addressee; // } else { // $sendto = "wufeet@wusfeetlinks.com"; // } $sendto = "wufeet@wusfeetlinks.com"; // Use php e-mail function, add From and Return-Path headers. mail($sendto, $subject, $body . $trailer, "Return-Path: $from\r\nFrom: $from"); // Now display back to user what we sent. $htmlbody = nl2br($body); //Insert
html tag in front of each newline. print("
Your message has been sent:


"); } // *** END function sendmailform *** // ***BEGIN MAIN CODE*** // Test if this is a request for an empty form. // If so, output a blank form. if ( $hidden == '' ) { printmailform('','','','','','','','',$returnto,$returntoname,$subject); exit; } // We received a form, so clean up the variables. $realname = trim($realname); $sitename = trim($sitename); $siteurl = trim($siteurl); $reciprocal = trim($reciprocal); $from = trim($from); $body = trim($body); // Now replace any period at the beginning of a line with a space // followed by a period. A period alone can mess up sendmail. // Stripping the slashes as well $body = str_replace("\n.", "\n .", $body); $body = stripslashes($body); // Now verify e-mail address. $error = checkemail($from); // And check that Real Name isn't blank. if ( strlen($realname) < 1 ) { $error = $error . "
Please enter your Name!"; } // And check that body isn't blank. if ( strlen($body) < 1 ) { $error = $error . "
Please supply message text!"; } // If an error exists return form with error message. if ( $error != "" ) { printmailform($error,$realname,$from,$sitename,$siteurl,$reciprocal,$body,$returnto,$returntoname,$subject); // Otherwise, send mail and display result to browser. } else { $trailer = "\n\nSent from: " . $SERVER_NAME . $REQUEST_URI . "\nReal Name: " . $realname . "\nSubmitted from IP Address: " . $REMOTE_ADDR . "\nBrowser Type: " . $HTTP_USER_AGENT . "\nReferred From: " . $returnto; sendmailform($from,$subject,$body,$trailer); $hidden = ''; } // *** ALL DONE *** ?>