如何在不设置 cron 作业的情况下定期发送电子邮件?
我正在使用 PHP 建立一个订阅网站,该网站将允许管理员设置向订阅者发送电子邮件的时间表(每月、每周、每天,全部精确到分钟)。是否有插件、扩展甚至库可以让我根据预定的时间表发送这些电子邮件?
我想过设置一个 cron 脚本来每分钟检查一次待处理的电子邮件,但根据我估计的网站流量,我担心这会给我的服务器带来太大的压力。
如果这个插件、扩展等能够提供分析数据作为回报,那就太好了。但这绝对不重要。
I'm setting up a subscription site using PHP that will allow admins to set up schedules (monthly, weekly, daily, all down to the minute) for when emails will be sent out to subscribers. Is there a plugin, extension, or even a library, that allows me to send these emails based on a predetermined schedule?
I thought of setting a cron script to check every minute for pending emails, but with amount of traffic I'm estimating for my site I'm worried that it would put too much of a strain on my servers.
It would also be nice if this plugin, extension, etc, could provide analytic data in return. But that's definitely not vital.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
cronjob 服务本身只占用很少的资源。它调用的脚本完成的工作会对您的服务器产生任何影响。这意味着无论您使用什么方法定期发送电子邮件、定时任务或其他方式,服务器发送这些邮件所承受的负载都是相同的。因此,如果您的服务器速度减慢太多,您可能需要专用服务器或更多资源。 cron 服务本身确实会减慢任何速度(除非你每秒调用它 10 次)
The cronjob service itself takes little resources. It is the work that is done by the scripts it calls that have any impact whatsoever on your server. This means that whatever approach you use to send emails regularly, cronjob, or something else, the load the server takes by sending those mails will be the same. So if your server is slowing down too much, you probably need a dedicated server or more resources. The cron services itself does slow anything down (unless you are calling it like 10 times a second)
您可以从外部、从您能够设置计划调用的地方(可能是您的 PC 或其他托管服务)调用 php 脚本。大多数共享主机支持时间表。查看控制面板(cpanel、plesk...):
You could call php script from outside, from somewhere where you will be able to setup scheduled calls (may be your PC or other hosting service). Most shared hostings supporting schedules. Look into control panel (cpanel, plesk, ...):