Hi!
Please help me with a mail problem:
I try to do a script that gets the email address and names from a query (MySQL) and sends a customized email.
It sends the email to the list, but also sends the custom message repeatedly to all the people.
Here's the code:
<?php
while ($r_direcciones=mysql_fethc_array($direcciones))
{
$to_address = $r_direcciones["email"];
$body = "Dear ".$r_direcciones["nombre"]."Blah, blah, blah....";
$headers = "From: [email]x@x.com[/email]";
$subject = "Correo";
mail($to_address, $subject, $body, $headers);
}
?>
The email looks like:
Dear User1. Blah, blah, blah...
Dear User2. Blah, blah, blah...
Dear User3. Blah, blah, blah...
To each one.
What am I doing wrong?
Thanks a lot for your help!
Miguel Mendez.