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!)
我正在开发一个网站,用户可以在该网站上选择接收各种活动的电子邮件通知(例如Google快讯)。该网站的早期版本存在一个问题,该问题意外地向同一些测试用户生成了数百封电子邮件。从那以后,这个bug就被修复了,但却引出了一个问题:有什么建议可以确保客户不会被电子邮件意外轰炸? (除了确保代码没有错误!)
3 个解决方案
#1
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.
尝试通过一种机制传递您的电子邮件,该机制检查客户是否在过去的x时间内通过电子邮件发送过邮件。如果是,那么请不要再次给他发电子邮件并存储日志供您稍后查看。
#2
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.
你应该把它嵌入你的“sendmail”功能中。
#3
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.
过滤输入的电子邮件,以确保在插入标题时它们只是一封电子邮件。这是邮件功能http://us3.php.net/manual/en/function.mail.php的一个大问题,因为它允许垃圾邮件发送者在电子邮件表单中输入多个额外的电子邮件并提交邮件并让你的服务器发送垃圾邮件。
#1
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.
尝试通过一种机制传递您的电子邮件,该机制检查客户是否在过去的x时间内通过电子邮件发送过邮件。如果是,那么请不要再次给他发电子邮件并存储日志供您稍后查看。
#2
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.
你应该把它嵌入你的“sendmail”功能中。
#3
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.
过滤输入的电子邮件,以确保在插入标题时它们只是一封电子邮件。这是邮件功能http://us3.php.net/manual/en/function.mail.php的一个大问题,因为它允许垃圾邮件发送者在电子邮件表单中输入多个额外的电子邮件并提交邮件并让你的服务器发送垃圾邮件。