I need an algorithm.

Say I have a form. The form is merely a list of checkboxes next to people's names. Those who are checked will receive an email.

Okay, so I know how to output all these names from my database and I can put their email addresses in the name field of the checkboxes, but I need a way to connect these boxes and the mail() function that will be carried out once the boxes are checked and the email form filled. I guess I just need to know how to put all the selected addresses into a string. Any advice on how to do that?
_________________________
Matt