安排电子邮件通知

发布于 2024-09-17 17:34:17 字数 198 浏览 2 评论 0原文

我正在尝试找出一个根据用户偏好发送电子邮件通知的好解决方案。用户可以设置

  • 每次事件发生时
  • 发出的通知每小时一次 每天
  • 一次
  • 每周一次

最好的方法是设置一个 crontab,每分钟运行一次 .php 检查是否需要发送任何内容?有没有其他方法/更有效的方法来安排这样的事情?

I'm trying to figure out a good solution for sending email notifications based on user preference. Users can set up notifications to come

  • Everytime the event occurs
  • Once an hour
  • Once a day
  • Once a week

Would the best way to do this be to set up a crontab that runs a .php every minute checking to see if anything needs to be sent out? Is there another way/more efficient way to schedule something like this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉风有信 2024-09-24 17:34:17

我想说的是:

  • 如果每次事件发生时都应该发送电子邮件,那么您就不需要任何 crontab。只需在事件发生时发送电子邮件即可。
  • 每小时运行一次 crontab。此 crontab 将获取过去一小时的所有事件,并将包含所有这些事件的电子邮件发送给请求每小时电子邮件的用户。
  • 对于具有每日和每周电子邮件偏好的用户,每天一次和每周一次执行相同的操作。

I'd say the following:

  • In case the email should be sent everytime the event occurs, then you don't need any crontab. Just send the email when the event occur.
  • Run a crontab once an hour. This crontab will fetch all events from the last hour, and send an email with all these events to the users requesting a hourly email.
  • Do the same once a day and once a week for users with daily and weekly emails preferences.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文