I ran the code, commenting out the include/require, mysql function calls, and code with user function calls, and supplied some values for the if tests... and I don't receive the error. This would indicate that it must be coming from a line I commented out or from something in one of the include/require files.
Here is the modified code to just past the mail(...) function call -
PHP Code:
<?php
error_reporting(E_ALL); // error reporting I set
session_start();
// require("config.php");
// include_once("$full_path_to_public_program/session.php");
// include("templates/main.html.php");
// include("templates/leftside.html.php");
// include("templates/refer_header.html");
$_POST['send'] = "1"; // value I set
if (isset($_POST['send']) AND $_POST['send'] == "1"){
// if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i', EscapeString($_POST['email']))) {
// $error .="<div class=\"error\">$RegistrationError[2]</div>";
// }
$_POST['sendername'] = "sender"; // value I set
if (!isset($_POST['sendername']) AND $_POST['sendername'] == ""){
$error .= "<div class=\"error\">$RegistrationError[3]</div>";
}
if (!$error){
$_POST['senderemail'] = $_POST['sendername'];
// $check = mysql_query("SELECT picid from $pic_tbl where picid = '".valid_id($_POST['pid'])."'") Or die (mysql_error());
// $row = mysql_fetch_array($check);
$ReferEmail = str_replace("{SENDER}", $_POST['sendername'],$ReferEmail);
//$ReferEmail = str_replace("{PASSW}", $_POST['pass'],$ReferEmail); // this line was already commented out.
$ReferEmail = str_replace("{PHOTO}","<a href=\"$siteurl/?id={$row['picid']}\">{$siteurl}/?id={$row['picid']}</a>",$ReferEmail);
$message = "<html><head></head><body><br />";
$message .= $ReferEmail;
$message .= "<br /></body></html>";
$headers = "From: {$_POST['sendername']} <{$from_address}>\r\nContent-type: text/html";
mail($_POST['email'], $ReferEmailSubject, $message, $headers);
echo "<tr><td><div class=\"txt_dbrown_bold02\" align=\"center\">$ReferSuccess</div></td></tr></table></td>";
// include("templates/newheader_end.html");
// include("templates/footer.html.php");
exit;
} else {
echo "<tr><td><div style=\"padding:10px; text-align:center\" class=\"txt_dbrown_bold02\">$RecommendToFriend</div></td></tr></table></td>\n";
// include("templates/referform.html.php");
// include("templates/footer.html.php");
exit;
}
}
Edit: I also recommend echoing the contents of the variables, at least - $_POST['email'], $ReferEmailSubject, $message, and $headers to make sure they contain the expected contents.
Edit2: To send HTML email, in addition to the content type, your $header string needs a MIME version and a charset item.