Ok, I actually write my site in ASP Classic, but ASP isnt a forum and, really, I am looking for generic logic.
I have a site with blog entries. Visitors can comment. I want to add an option for visitors to receive an email when new comments are posted. So, I guess I save the options to a table similar to:
Then, when blogid 20 gets a new comment, I email userids 100, 101, 102.
I am using an ASP email component and with small numbers like this, the logic is simple:
Get records from EmailWhenNewComments where blogid=20
For each record
But with enough records I know this will be very inefficient. When a visitor saves a comment, it will take a long time to send all emails before returning.
What is the correct way to handle this? Does the emailing get de-coupled from the comment saving and run as a seperate process, kicked off by the save? Does the emailing logic just need to be made more efficient with something I am not aware of?
Any input would be greatly appreciated.