I try to send mail to my friend using mail() function. I kept address book in file using this format: name1@address.com"\n"name2@address.com My problem is when start loop in order to input address PHP says "Server Error". How can I do?
sendmail.php <?
$emaillist="data/emaillist.txt"; $addresses = file($emaillist); for($index=0;$index<count($addresses);$index++){ Mail("$temp=$addresses[$index]",$subject,$body); }
?>
I'll take a guess and say change:
Mail("$temp=$addresses[$index]",$subject,$body);
to
mail($addresses[$index],$subject,$body);