Обновление строк в цикле while php

У меня есть рабочий почтовый скрипт, и времена, когда время отправки, потому что наше интернет-соединение нестабильно. Мне было рекомендовано отмечать отправленные сообщения на письма после их отправки. Я пробовал этот скрипт, но до сих пор он обновляет только первое отправленное им электронное письмо, а не остальное.

if(isset($row_get_sender['setfrom_email'])) { do { $mail->AddAddress($row_get_recipient['email']); $mail->Send(); $update_recipient; $mail->ClearAddresses(); } while($row_get_recipient = mysql_fetch_assoc($get_recipient)); } 

и мои запросы:

 mysql_select_db($database_mail, $mail); $query_get_recipient = "SELECT * FROM `to` WHERE `mailSent` = '0'"; $get_recipient = mysql_query($query_get_recipient, $mail) or die(mysql_error()); $row_get_recipient = mysql_fetch_assoc($get_recipient); $totalRows_get_recipient = mysql_num_rows($get_recipient); $query_update_recipient = "UPDATE `to` SET `mailSent` = '1' WHERE `email` = '$row_get_recipient[email]'"; $update_recipient=mysql_query($query_update_recipient,$mail) or die (mysql_error());