@mrjaguar: Seeing as I have no boxes that run sqmail DB, no I will not be porting it.
@Chadi: It appears to be starting the loop but not finishing it. Ensure the script has permission to read the pref files and you have entered the proper mysql information