Right now im planning to create a newsletter sender module. I have all the smtp servers quite running and ready. My lists are ready too. I need now to programa a Cronjob (I know how to do this too) so every 3 minutes some php file is executed and the mails delivered.

How should my php be?
# get the message to send
# get the list of non-sent email address
# send the message to them in a throttling basis ( 20 each 3 minutes, maybe less, maybe more)
# mark those addresses as "already sent"
As you can see, Im actually more worried about the logic and structure of the file than the coding. I know how to do this in PHP, but... i have a bad feeling about the logic. I was hoping you to help me find some better way to do this, if there is any.