View Single Post
  #8 (permalink)  
Old 07-05-06, 11:12 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
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.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???

Last edited by mab; 07-05-06 at 11:35 AM. Reason: Additional troubleshooting
Reply With Quote