Is this site hosted remonely y a third party company, or on one of your own computers locally? The reason I ask is because your web host may have something in place to prevent you from sending out (x) number of emails per session... My host does this at 3000 which is why I am asking...
Otherwise, you may have to consider adding a field to your table called "Sent" or something like that. Then rewrite your code to send the mail and update the Sent field in your table in each row. Then limit your select results to 2000 (or so).
Then write another loop which the above loop is nested in, which will rerun the above query until they are all marked as sent. (based on total rows/2000 so you know how many times to loop through the iteration.)
Lastly, once all mail is processed, update the Sent field in your table again (for all rows this time) to have them marked unsent so they are prepared for your next mass mailing.
I know this sounds a bit hokey, but it was a loophole that worked on my host...