creating a customised mailing list
Posted: Tue Aug 05, 2003 10:24 am
I have created a mailing list that will send out mail via 1 of 6 lists.
I can get it to send the mail out to recipients, but I would like to personalise it :- ie Dear fred,
I cannot seem to get my head around it.
// 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];
$email = $info[1];
$company = $info[2];
$joined = $info[3];
// Build to address including subscriber name
$mailTo = "$name <$email>";
$mailBody ="Dear $name, /n $mailBody";
THIS IS WHERE it should say Dear Fred. but it adds each $name field each time it mails so that email 10 has 10 names!!!!!!
// Send email to
mail($mailTo, $mailSubject, $mailBody, "From: " . $mailFrom);
}
print "Email sent to all subscribers";
}
I am sure it is simple I just can't see it.
I can get it to send the mail out to recipients, but I would like to personalise it :- ie Dear fred,
I cannot seem to get my head around it.
// 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];
$email = $info[1];
$company = $info[2];
$joined = $info[3];
// Build to address including subscriber name
$mailTo = "$name <$email>";
$mailBody ="Dear $name, /n $mailBody";
// Send email to
mail($mailTo, $mailSubject, $mailBody, "From: " . $mailFrom);
}
print "Email sent to all subscribers";
}
I am sure it is simple I just can't see it.