简体   繁体   English

如何在不设置Cron作业的情况下发送定期排定的电子邮件?

[英]How can I send regularly scheduled emails without setting up a cron job?

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. 我正在使用PHP设置一个订阅站点,管理员可以使用该站点设置时间表(每月,每周,每天,直到分钟),以安排何时将电子邮件发送给订阅者。 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. 我曾想过设置一个cron脚本来每分钟检查一次待处理的电子邮件,但是由于我估计自己的网站有很多流量,我担心这会对我的服务器造成太大的压力。

It would also be nice if this plugin, extension, etc, could provide analytic data in return. 如果此插件,扩展等可以提供分析数据作为回报,那也很好。 But that's definitely not vital. 但这绝对不是至关重要的。

The cronjob service itself takes little resources. cronjob服务本身占用的资源很少。 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. 这意味着,无论您用于定期发送电子邮件,cronjob或其他方式使用什么方法,服务器通过发送这些邮件所承担的负载都是相同的。 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) cron服务本身不会降低任何速度(除非您每秒调用它的次数为10次)

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). 您可以从外部调用php脚本,该脚本可以设置预定的调用(可能是您的PC或其他托管服务)。 Most shared hostings supporting schedules. 大多数共享主机支持计划。 Look into control panel (cpanel, plesk, ...): 查看控制面板(cpanel,plesk等):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM