As JoLoCo points out, the AddAddress() method simply adds a new address to the existing recipient list. And since you do it like an add / send cycle, you send a bunch of duplicate copies to the first recipient, one less to the second, etc.
What you need:
while($row = mysql_fetch_row(...)) { $mail->AddAddress($row[0]); $mail->send(); $mail->ClearAllRecipients();
On the other hand, since this is spam on your mail server with a large number of separate emails, another option is to create one SINGLE and BCC message for all recipients.
$mail->AddAddress(' you@example.com '); // send the mail to yourself while($row = mysql_fetch_row(...)) { $mail->AddBCC($row[0]); } $mail->send();
This option is most likely preferable. You only generate one email and allow the mail server to do the hard work of sending copies to each recipient.
source share