PHP:通过cronjob发送电子邮件,并设置每分钟的电子邮件发送量 [英] PHP: Send Email via cronjob and set amount of email send per mins

查看:280
本文介绍了PHP:通过cronjob发送电子邮件,并设置每分钟的电子邮件发送量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序用于发送组电子邮件,我设置一个玉米每分钟为这个程序,并设置执行每2 /分钟,并检查现在的时间是否匹配我定义的时间在db。如果真的程序将运行和发送电子邮件,否则第n ...

i have a program which use to send group emails, i set a cornjob per mins for this program, and set execute per 2nd/min, and check if the now time is match to my defined schedule time in db. if true the program will run and send email, else nth...

问题是我想动态设置每分钟由用户发送的电子邮件的数量,让说我有10000个电子邮件发送,我想发送3电子邮件每分钟,这样的东西,但我不能找到的方式,当使用cronJob,(设置cookie?记录当前电子邮件到db?),
自i发现如果我使用sleep(),它会导致php执行限制错误...

the problem is i want to dynamic set the amount of email sending per mins by user, let say i have 10000 emails to send, and i want to send 3 emails per min, something like that, but i cant find the way when using cronJob, (set cookie? record the current email to db?), since i found that if i use sleep(), it will cause php execute limit error...

任何人都可以告诉我该怎么做?
或使用其他方法来执行计划任务?梨?
如果使用其他方法,可以显示如何使用它?
请和Thx

Can anyone tell me how to do that? or using other method to do schedule task? pear? if using other methods, can show how to use it briefly ? Please And Thx

推荐答案

我认为应该在应用程序级别而不是cron作业级别设置此配置。

I think you should set this configuration at the application level rather than the cron job level.

让我们说,cron作业应该每分钟运行一次,但应用程序本身应该知道当cron作业运行时发送多少电子邮件,通过检查最后一个e-邮件发送,让我们说,再发送3封电子邮件等。

Let's say, cron job should run every minute but the application itself should know howmany e-mails to send when a cron job runs by checking the datetime for the last e-mail is sent, and let's say, send 3 more e-mails and so.

这篇关于PHP:通过cronjob发送电子邮件,并设置每分钟的电子邮件发送量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆