Look quickly, you're using data in the $_POST array that isn't in the form. Specifically:
$POST['visitor'] and $POST['attn'].
Also, this line:
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
has some logic issues. Read it out loud to yourself and think about it. It should sound something like this:
If 'Not $visitormail' is empty AND ($visitormail doesn't contain an '@' or $visitormail doesn't contain a '.'
If I were to rewrite it, I would probably tell you to use a try / catch statement to simplify things. Something like:
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$attn = $_POST['attn'];
try
{
if(empty($visitormail))
{
throw new Exception ("Missing email address");
}
if(
($offset = strpos($visitormail, "@")) === false ||
strpos($visitormail, ".", $offset) === false
)
{
throw new Exception ("Invalid email address format.");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
From: $visitor ($visitormail)\n
Additional Info : Sign me up for the newsletter... please.
";
$from = "From: $visitormail\r\n";
mail("clientemailaddress@gmail.com", $subject, $message, $from);
}
catch(Exception $e)
{
// Output generic headers
echo "<h2>Use Back - Enter valid data</h2>
<h2>Feedback was NOT submitted</h2>\n";
// Output the error message
echo $e->getMessage();
echo "Go Back! !";
// Stop all execution
exit;
}
Hope that helps.