Here is what I have tried so far...
First I tried...
<?php
//$name = $_POST["email"];
$name = $_POST["name"];
$policynumber = $_POST["policynumber"];
$phonenumber = $_POST["phonenumber"];
$issue = $_POST["issue"];
$purchased = $_POST ["purchased"];
$infocheck = $_POST ["infocheck"];
$additionalinfo = stripslashes($_POST["additionalinfo"]);
//checkbox value readout
$mailcc = $_POST['sendmetoo'];
$email_to = "SalesLevel2@xxx.com"; // Who the email is to
$email_from = $_POST['emailfrom']; // Who the email is from
$email_subject = $policynumber.' - '.$issue; // The Subject of the email
//here you can define whatever you want to...
$headers = "MIME-Version: 1.0\r\n";
//$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
$headers .= "To: <".$email_to.">\r\n";
$headers .= "From: ".$email_from."\r\n";
//we control if sendmetoo is checked...
if($mailcc == 'sendtome'){
$headers .= "Cc: ".$email_from."\r\n";
}
//$headers .= "Bcc: noone@nowhere.com\r\n";
$email_message = "Sales Level 2,";
$email_message .= "\n\nPolicy Number: " .$policynumber;
$email_message .= "\nClients Name: " .$name;
$email_message .= "\nPhone Number: " .$phonenumber;
$email_message .= "\nReason(s): " .$issue;
$email_message .= "\nPurchased Already: " .$purchased;
$email_message .= "\nAll info correct?: " .$infocheck;
$email_message .= "\n\nAdditional Information: " .$additionalinfo;
"\n\n\n\n". // Message that the email has in it
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok && ((strpos($emailfrom, '@pethealthinc.com') === FALSE) || (strpos($emailfrom, '@24petwatch.com') === FALSE))) {
echo "<font face=verdana size=2><center>Your message has been sent<br>
to Sales Level 2<br>
Click <a href=\"#\" onclick=\"history.back();\">here</a> to go back</center>";
} else {
die("Sorry but the email could not be sent.<br> Please go back and try again!<p><u>Remember</u>, if you're not entering <b>YOUR</b> own email address, it is not going to work<br>ie:lambertj@xxx.com");
}
?>
That didnt work though, it still sends to anything... then I tried under the advice of a friend...
<?php
//$name = $_POST["email"];
$name = $_POST["name"];
$policynumber = $_POST["policynumber"];
$phonenumber = $_POST["phonenumber"];
$issue = $_POST["issue"];
$purchased = $_POST ["purchased"];
$infocheck = $_POST ["infocheck"];
$additionalinfo = stripslashes($_POST["additionalinfo"]);
//checkbox value readout
$mailcc = $_POST['sendmetoo'];
$email_to = "SalesLevel2@xxx.com"; // Who the email is to
$email_from = $_POST['emailfrom']; // Who the email is from
$email_subject = $policynumber.' - '.$issue; // The Subject of the email
//here you can define whatever you want to...
$headers = "MIME-Version: 1.0\r\n";
//$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8\r\n";
$headers .= "To: <".$email_to.">\r\n";
$headers .= "From: ".$email_from."\r\n";
//we control if sendmetoo is checked...
if($mailcc == 'sendtome'){
$headers .= "Cc: ".$email_from."\r\n";
}
//$headers .= "Bcc: noone@nowhere.com\r\n";
$email_message = "Sales Level 2,";
$email_message .= "\n\nPolicy Number: " .$policynumber;
$email_message .= "\nClients Name: " .$name;
$email_message .= "\nPhone Number: " .$phonenumber;
$email_message .= "\nReason(s): " .$issue;
$email_message .= "\nPurchased Already: " .$purchased;
$email_message .= "\nAll info correct?: " .$infocheck;
$email_message .= "\n\nAdditional Information: " .$additionalinfo;
"\n\n\n\n". // Message that the email has in it
if ((strpos($emailfrom, '@pethealthinc.com') === FALSE) || (strpos($emailfrom, '@24petwatch.com') === FALSE))
{
$ok = FALSE;
}
else{
$ok = @mail($email_to, $email_subject, $email_message, $headers);
}
if($ok) {
echo "<font face=verdana size=2><center>Your message has been sent<br>
to Sales Level 2<br>
Click <a href=\"#\" onclick=\"history.back();\">here</a> to go back</center>";
} else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
?>
The second I thought looked promising, but I am getting a syntax error on the line with the
if ((strpos($emailfrom, '@pethealthinc.com') === FALSE) || (strpos($emailfrom, '@24petwatch.com') === FALSE))