PHPMailer sending double emails

I am working on theapplication that fetches clients emails from DB, stores them in a array, loop through the array and send email to each client individually.

The problem occurred when PHPMailer is sending a double email to clients and also in and in one of emails "to" field contains both recepient address and in second email there is also a second clients emails as well.

You are not removing the address from the mail, so when you add a second one, the first one is still there and both will see the other address.

You are using a header redirect in your loop without terminating your script. This can cause code after the redirect to run, but there is no guarantee for how much and how long.

The first problem you can solve by clearing the recipients at the end of the loop:

$mail->ClearAllRecipients();

As for the second problem, you should not redirect anywhere inside the loop and when you redirect after all messages have been sent, you should exit your scipt using exit; so that nothing gets executed after that.