Hi, i am in the process of building a custom site in php. I am designing the user’s notification settings and i am trying to decide on what options the user can check and uncheck in their settings. (please do not suggest open source software as this site needs to be custom for many reasons
i have added the following setting, and i am trying to decide whether to leave it their or not:
 email me when another member comments on the same post
I am aware that some posts will have 500+ individual comments so that means that if all of the users have the above option selected, the system will need to send out 500+ emails to all of the users, everytime someone adds a new comment.
Would this slow down my system or is PHP well able to cope with these type of functions these days… thanks in advance for your help…
It shouldn’t be too much if you use some sort of email throttling/batching/queuing. I would also suggest doing something like the sitepoint notifications where it only notifies you of the first new comment until you log in again.
Ok cool, have you any idea how i would implement that… not looking for code, just a process of how it would work… thanks…
There are a bunch of different ways you could implement a batch email system. The simplest would probably be to create a DB table to contain a queue of notifications that need to be sent. Then set up a cron to run every 10 minutes or so and send out X many emails at a time.
I would check with your hosting provider’s terms of service to see what they allow to make sure you don’t get flagged. Many hosts only allow X many emails to be sent per hour.
The best way to handle batch emails in large volumes is really to offload the work to a provider that specializes in that. Where I work we use Contactology but there are several others. Just make sure you find one with a well documented and flexible developer API. Otherwise it is probably going to be hell on Earth attempting to queue emails based on a hosting providers restrictions. Unless you are running your own server with the ability to configure email as you please any method you use without an external provider likely will not scale infinitely.