Ok. Lets say that you have a textfile in a form like this:
1979-05-12|Jack Slater|jslater@xxx.net
1979-04-03|John Doe|jdoe@somewhere.com
(year-month-day|name|email)
In the script we go throught the file line by line and when the right date is found, send the email to the email in that row and put the name in the message.
<?php
$f=file('birthday.txt');
$today=date('m-d');
for($i=0;$i<count($f);$i++) {
$info=explode ('|',$f[$i]);
if (substr($info[0],5)==$today) {
$message='Happy birthday '.$info[1].'!';
sendmail('me@somewhere.com',$info[2],'Happy Birthday!',$message);
}
}
function sendmail($from,$to,$subject,$message) {
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From:".$from."\n";
mail($to,$subject,$message,$headers);
}
?>