views:

62

answers:

3

I'm working on a site in which users can opt-in for email notifications for various events (think Google Alerts). An early version of the site had a problem that accidentally generated hundreds of emails to the same few test users. That bug has since been fixed, but leads to the question: what are some recommendations for ensuring that customers won't accidentally be bombarded with email? (Aside from ensuring that the code is bug-free!)

+1  A: 

You can keep a list of "last mail send" (with timestamp) per user/email and refuse to send the mail if the last mail was send only a (day/hour) ago.

You should embed this in your "sendmail" function.

Gamecat
+3  A: 

Try passing your emails through a mechanism that checks whether a customer has been emailed in the last x time. If yes, then don't email him again and store a log for you to check later.

Konstantinos
A: 

Filter the input emails to be certain that they are only a single email when put in to the header. This is a big issue with the mail function http://us3.php.net/manual/en/function.mail.php since it allows a spammer to put in multiple extra emails in a email form and submit a message and have your server send out their spam email.

Tchalvak