My intention is to loop through my array, compose and send a separate email to each. Instead, the loop composes every email into a single email and sends that to every record. So each person receives an email with everyone else’s email in the body.
[php]while($row = $result->fetch_assoc()){
echo $row[‘FName’]. " - ". $row[‘email’];
echo “
”;
$email = "[email protected]";
$emailto = $row[‘email’];
$subject = “survey”;
$headers = “From: Michelle Hartly <$email>” . “\r\n”;
$body .= " \n "
.$row[‘FName’].",\n". “\n”
."Your subscription is expiring!;
$send = mail($emailto, $subject, $body, $headers);
//sleep(10);
}[/php]