salve a tutti,
spro possiate darmi una mano. ho un problema con l'invio di email da un a pagina php. gli indirizzi sono in una tabella di un db mysql, la pagina esegue la query e invia le email. il problema è che il testo dell'email viene ripetuto n volte man man che la query scorre i destinatari. mi spiego meglio, ad esempio se il mio indirizzo è il quinto della lista, riceverò il testo ripetuto 5 volte. di seguito il codice utilizzato.
help... qualcuno può aiutarmi?Codice PHP:
$cerca_email="select distinct email, testo from email";
//die("$cerca_email - email -> $email");
$cerca_email2=mysql_query("$cerca_email"); while(list($email)=mysql_fetch_row($cerca_email2))
{
// Removes html tags and whitespace from input data
$email =strip_tags(trim($email));
$subject ="Estensione convenzione AssoRisparmio";
$body =strip_tags(trim($body));
$from ="info@assorisparmio.it";
$headers ="Mime-Version: 1.0\r\nContent-Type:text/plain charset=\"iso-8859-1\"\r\n";
$headers .="Content-Transfer-Encoding: 7bit\r\n";
$headers .="X-Priority: 3\r\n";
$headers .="X-PHP-Mail-Priority: Normal\r\n";
$headers .="X-Mime-OLE: Produced by MS MimeOLE v5.00.3000.100\r\n";
$headers .="X-Mailer: PHP Mail generated by:PHPMailer v1.0\r\n"; $headers .="From: $from\r\n";
$headers .="Reply-to: $from\r\n";
$message .="\nInvio testo a -> $email";
$message .="\n\n\n\n Cordiali Saluti \n Assorisparxxxx";
$message .="\n-------------------------------------\n";
$message .="www.assorisparxxx.it\n"; $message .="==================================\n";
// formats the input and sends the email @$send=mail($email,$subject,$message,$headers); // prints success or failure to the user }
header("Location: url]http://[/url]".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."email.php?testo=ok");
grazie mille