Greetings all---
I've created an email admin for a customer to use to send emails to people in his customer list. A low end mass-emailer for sending about 100 emails at one setting. The script works, but I'm some of the header settings are showing in the email message body, and when replying to the em
ail, it goes to the wrong person. The hosting server is DreamHost.
I've done this set up before with no problems like this. In fact, I ported this over to another website and it worked fine there. I thought maybe this is something to do with the PHP on the DreamHost server.
First my code - in part...
// I select names and email address from a database
$from = "anna@barrongames.com";
while( $data=$results->fetchRow(DB_FETCHMODE_ASSOC) ){
if( !empty($data['email']) ){
# prepare the email and headers...
$name = $data['fname']." ".$data['lname'];
$to = $data['email'];
$headers = "To: $name <$to>\n\n";
$headers .= "From: 'BarronGames.com' <$from>\r\n";
$headers .= "Reply-To: 'BarronGames' <$from>\r\n";
$headers .= "Return-Path: $from\r\n";
# $subject comes from the email form
$message = "Dear $name\r\n"; // personalize each email
$message .= $content;
# send the email to this contact person
if( mail($to, $subject, $message, $headers) ){
print "<br />Email sent to $name at $to";
}
}
}
Now, I test the email by sending it to me.
First, I see this in the message body of my email.
From: 'BarronGames.com' <anna@barrongames.com>
Reply-To: 'BarronGames' <anna@barrongames.com>
Return-Path: anna@barrongames.com
Dear John Cowan
blah, blah, blah
I've never seen those headers appear in the message body before.
Next, when I test the Reply To, I get this in the To: entry of my email client:
Gregory Bacorn <barrongames@fox.dreamhost.com>
It should read: anna@barrongames.com
I've done php email scripts many times and this is the first time I've seen this.
Any ideas on how to fix this or what is causing it?
Thanks,