The code I am using works, however, when there is more than 1 user, it sends the 2nd user the email twice in the body. For 3 users, 1 person gets the same body 3 times etc.. I am thinking i need to use a 'FOREACH' but I not 100%, please give me some assistance.
Thanks
$query = mysql_unbuffered_query("SELECT useremail FROM
auths WHERE (TO_DAYS(NOW()) - TO_DAYS(activefrom))>15 AND useremail != '' AND exp != '1'");
//Do all user emails
while($user = mysql_fetch_row($query)) {
//Dispatch message
$header = "Return-Path: [email]noreturn@somewhere.com[/email]\r\n";
$header .= "From: My Site <noreturn@somewhere.com>\r\n";
$header .= "Content-Type: text/html;charset=iso-8859-1;\r\n\r\n";
$message .= "Your Trial Account has expired.<BR>\n";
mail($user[0], 'Expiring Account', $message, $header, '-fnoreturn@somewhere.com');
//echo "$user[0]<BR>";
}