Vedi così
Codice PHP:
$getemail = mysql_query("SELECT email FROM newsletter") or die(mysql_error());
$cont=0;
$arrErr = array();
while($data=mysql_fetch_array($getemail)) {
$email=$data["email"];
$header = "From: $return_email\nReply-To: $return_email\nContent-Type: text/html; charset=iso-8859-1";
if ($cont==10) {
sleep(6);
$cont=0;
}
$cont++;
// Salvo l'email per la quale si è verificato l'errore
// Puoi salvarti anche un messaggio o quant'altro ti pare
if(!mail("$email", "$title", "$body", "$header"))
$arrErr[] = $email;
}
if(count($arrErr) > 0) {
// Gestisci l'errore che sai si è verificato per ogni email presente nell'array
}
else {
header("Location: messaggio.php?messaggio=Tutto%20ok!");
}