Muultiple messages, different recipient groups
I'm writing a cron job where emails need to be sent at a specific time. Sometimes there could be, for instance, three emails to go out at 5:40. Each email has a different group of recipients.
I've read this post
so I have a pretty good handle of how to iterate to the next message, but I can't get my head around how to deal with the recipients.
The DB uses one table to store the messages, and a relational table to store the recipients.
messages tbl: autoID msgSender msgText msgSubject etc.
recipients tbl: autoID msgID recipientID
Basically I need to run a new query for each msgID to discover the recipients, and I'm not sure how to start. If ya'll could point me in the right direction I'd be grateful.
(For the curious, I'm setting up a tabletop-type scenario for multiple classes of a college course. Each class will get the messages at the same time, but the message recipients are in different classes. The classes don't know about each other.)