bella classe!
le mail vengono inviate correttamente ma ci sono alcuni problemini
posto il codice modificato da me:
Codice PHP:
include 'db.php';
include 'header.php';
require("class.phpmailer.php");
$mail = new phpmailer();
$mail->From = "list@example.com";
$mail->FromName = "List manager";
//$mail->Host = "smtp1.example.com;smtp2.example.com";
//$mail->Mailer = "smtp";
$query= mysql_query("SELECT * FROM newusers WHERE ammesso = '1' ")
or die("Query Fallita: " . mysql_error());
while ($row = mysql_fetch_array($query))
{
// HTML body
$body = "Ciao <font size=\"4\">" . $row["name"] . "</font>,
";
$body .= "Email di prova dal server
";
$body .= "Saluti,
";
$body .= "phpmailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Ciao " . $row["name"] . ", \n\n";
$text_body .= "Email di prova dal server.\n\n";
$text_body .= "Saluti, \n";
$text_body .= "phpmailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddBCC($row["email"], $row["name"]);
//$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
if(!$mail->Send())
echo "Si sono verificati degli errori nell'invio all'indirizzo: " . $row["email"] . "
";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
//$mail->ClearAttachments();
echo "{$row['email']}";
}
in pratica succede che se dalla query trova più di una corrispondenza, tutti ricevono la mail ma il primo utente si becca la mail che deve essere spedita a lui più tutte le email degli altri!