creating a customised mailing list

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
roscoe
Forum Commoner
Posts: 85
Joined: Tue Aug 05, 2003 10:24 am
Location: essex uk

creating a customised mailing list

Post by roscoe »

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!!!!!! :roll:

// 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.
Post Reply