Well, constructed from the help i received from 
some of you, this is the end result of my attempts to 
be able to send email to everyone listed in a file 
and including their names in the email. i would 
appreciate any feedback or suggestions for
simplification, etc.

<?$doc="emaillist.dat";$fp=fopen("$doc","r");
$contents = fread ($fp,filesize $doc));
fclose($fp);//read file contents into variable
$list=explode("\n",$contents); //explode each dataset
into array
$size=count($list);//count number of array items
$size=$size-1;//subtract one for looping process
$counter=0;//set counter
while($counter<$size){ //do until no more array items 
$list2=explode("#",$list[$counter]); //explode each
dataset into two separate arrays (name/email)
$to=$list2[1];//set "to" to email address
$subject="Newsletter";
$msg="Hello $list2[0], bla bla bla"; //include name in
message
mail("$to,$subject,$msg");  //individual mail during
loop
$counter++; //increment
}
?>

i know several of you have expressed concerns 
about overloading email servers, but since i have less

than 20 people on the list, i'm sure it can handle it.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to