Hello,
If someone can help me, I would greatly appreciate it. I am running php 4.1.1 under win2k and I have pointed smtp to our outgoing mail server on the network and specified a from address in the ini file. I can send mail fine if I use the following:
// Mail Test
mail("steve@paythrough.com", "Test mail from Wintel Box", "This is the body.");
However, if I try to do it this way:
$i=1;
$fd = fopen("customer_list.txt", "r");
while(!feof($fd))
{
$line = fgets($fd, 4096);
$fields = split("\t",$line);
$email = $fields[0];
$fname = $fields[1];
$lname = $fields[2];
$date = date("D\, j M Y G:i:s T");
$to = $fname." ".$lname." <".$email.">";
$msg = make_mail_body($fname,$lname); //the function make_mail_body is returning a body of text fine
$version = phpversion();
$headers = "Date: ".$date."\r\nFrom: Fake User <fake@address.com>\r\nReply-To: Fake User <fake@address.com>\r\nContent-type: text/plain\r\nX-Mailer: PHP/".$version;
// Do stuff with the line here
mail("$to", "Important information about your Paythrough account", "$msg", $headers);
echo $i.". Sent mail to ".$email.", ".$fname." ".$lname."<br>\n";
$i++;
}
fclose($fd);
It returns:
Warning: Server Error in c:\steve\paythrough\vhost\send_mail.php on line 63
which is the line the mail() call is on. I really think it's something in the headers, but I have no idea (I've tried removing the "From:" header with no success). Is there a list of valid mail headers somewhere? I read on some site (php.net I think) that Bcc isn't valid under Winders and I am thinking that there are probably others I am hanging myself up on.
Any advice would be greatly appreciated.
Steve