Bit of a pain this one, been on it 3 days now.
I have a PHP maillist developed by my own fair hand. It works BUT
I wish to personalise the email just a little more. Here is the bit that gets me..............
// For each subscriber line...
foreach($subscribers as $subscriber) {
// split subscriber info into array
$info = explode('|', $subscriber);
// Assign array to meaningful variable name
$name = $info[0]; $myname = $info[0];
$email = $info[1];
$company = $info[2];
$joined = $info[3];
// Build to address including subscriber name
$mailTo = "$name <$email>";
$mailBody2 = $mailBody;
$mailBody = "Dear {$myname}, \n".$mailBody2;
$mailSubject = stripslashes($mailSubject);
$mailBody = stripslashes($mailBody);
// Send email to
mail($mailTo, $mailSubject, $mailBody, "From: " . $mailFrom);
$myname = null;
}
print "Email sent to all subscribers";
}
What happens is email 1 goes fine
Dear Fred,
blah blah
email 2
Dear Betty,
Dear Fred,
blah blah
email 3
Dear Barney,
Dear Betty,
Dear Fred,
blah blah
You get the picture. But I can't see logically why it would from above code.