RE: [PHP] mailing multilple addresses...?
| From: | Jay Blanchard | Date: | Wed, 19 Nov 2003 16:42:35 +0000 |
| Subject: | RE: [PHP] mailing multilple addresses...? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-170312@lists.php.net to get a copy of this message | ||
[snip]
if ($action == 'send') {
$fimail[] = explode(",", $list);
$count = count($fimail[]);
$show = "<b>Users that have been mailed:</b><br>";
$i = 1;
while ($count > $i) {
mail($fimail[], "Subject", $message, $headers);
$show .= "<br>$fimail";
$i++;
}
} else if ($action == '') {
$show = "<b>Users to be mailed:</b><br>";
$show .= "
<form method=\"post\" action=\"$PHP_SELF\">
<textarea name=\"list\"
style=\"width:300px;height:150px;\"></textarea>
<input type=\"hidden\" name=\"action\" value=\"send\">
<input type=\"submit\" value=\"Send Mails >>\">
</form>
";
}
[/snip]
First of all, $i is always going to be greater than 1 .... you have set
up an infinite loop. Then
if ($action == 'send') {
$fimail = explode(",", $list);
$count = count($fimail);
$show = "<b>Users that have been mailed:</b><br>";
for($i = 0; $i < $count; $i++){
mail($fimail[$i], "Subject", $message, $headers);
$show .= "<br>$fimail";
}