I have an odd error message.
No recipient addresses found in header
I searched through google but didn't get a clear answer. Can anybody enlighten me?
echo "<form method='post' action=''> <span class='text_reg'>Please enter your email address<br />
<input type='text' name='email' /></span><p>
<input type='submit' value='Request Application'></form></p> ";
//partial message included in email (shortened for PHPbuilder question
$sayWhat="
NOTE: D0 NOT REPLY TO THIS EMAIL. It is an unmonitored email address. For specific questions please see CONTACT INFO below";
$to = $_REQUEST["email"];
$subject = $_SESSION['tournName'];
$body = $sayWhat;
$dodgy_strings = array(
"content-type:"
,"mime-version:"
,"multipart/mixed"
,"bcc:"
);
function is_valid_email($email) {
return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s]+\.+[a-z]{2,6}))$#si', $email);
}
function contains_bad_str($str_to_test) {
$bad_strings = array(
"content-type:"
,"mime-version:"
,"multipart/mixed"
,"Content-Transfer-Encoding:"
,"bcc:"
,"cc:"
,"to:"
);
foreach($bad_strings as $bad_string) {
if(eregi($bad_string, strtolower($str_to_test))) {
echo "$bad_string found. Suspected injection attempt - mail not being sent.";
exit;
}
}
}
function contains_newlines($str_to_test) {
if(preg_match("/(%0A|%0D|\\n+|\\r+)/i", $str_to_test) != 0) {
echo "newline found in $str_to_test. Suspected injection attempt - mail not being sent.";
exit;
}
}
if (is_valid_email($email)) {
echo 'Invalid email submitted - mail not being sent.';
exit;
}
contains_bad_str($email);
contains_bad_str($subject);
contains_bad_str(body);
contains_newlines($email);
contains_newlines($subject);
$headers = "From: $email";
$headers = "Content-type: text/plain; charset=UTF-8\r\n";
mail($to, $subject, $body, $_SESSION['tournName']);