Question of method here.
Every time someone responds to a comment you leave in my application, I want to send an email to that person (if notifications is on)…
At the moment i have a simple html php mailer that goes through every user that wants an email notification and sends it off..
This is working great, however lets say 5000 people all want a notification from this comment and people are commenting once every minute… will this cause a problem with php passing the mail over to the mail server or should it be able to cope with a for loop.. sending to all of those users every 1 minute?
Am i missing out on a trick?
Scalability is going to be a major issue. However, more pressing is to examine the hosting you have right now. Big shared services like GoDaddy and HostMonster will throttle you at a certain amount per hour, which is in their TOS. Review that before anything.
Perhaps you could write your script to do a digest, and “bank” messages to users if they have x amount of activity per hour, etc.
Finally, consider that Email is not an exact science and you won’t be able to guarantee delivery in an exact time period or at all for that matter. To increase deliverability you’ll have to monitor your server, not hit services too many times in a row (for instance, AOL barks if you send more than a handful to them per second) and have a good maturity with your respective domain/IP to increase “trust”
It can be done. My company’s app sends out hundreds of thousands of emails per day between three servers. But it’s by no means trivial, and has taken two engineers more than a year to get really stable.