在数据库中存储的自动时间发送电子邮件
对于大学的一个项目,我需要在每天的特定时间、特定日期之间向一组用户发送电子邮件。
发送电子邮件所需的时间存储在 MySQL 数据库中,如下所示:
Name | Email address | Start | Finish | Time
User 1 | [email protected] | 20111008 | 20111015 | 1630
User 2 | [email protected] | 20111011 | 20111025 | 0900
etc, etc
我们在基于 Linux 的服务器上主要使用 PHP。
发送给每个人的电子邮件的文本都是相同的。许多用户可能会指定相同的时间,但我可以弄清楚如何使呼叫唯一。
有没有一种方法,当数据插入数据库时,我可以创建一个计划作业在每天的指定时间运行?如果已完成数据,则删除所述预定作业?我可以弄清楚脚本需要是什么,但我不确定使用什么技术来创建/运行/删除计划的作业。
非常感谢帮助!
For a project at university I have a requirement to send an email to a list of users, at a certain time each day, between certain dates.
The times required to send the emails are stored in a MySQL database like so:
Name | Email address | Start | Finish | Time
User 1 | [email protected] | 20111008 | 20111015 | 1630
User 2 | [email protected] | 20111011 | 20111025 | 0900
etc, etc
We're using mostly PHP on a linux-based server.
The text for the email to everyone will be identical. It is probable that many users will have the same time specified, but I can figure out how to make the calls unique.
Is there a way that, when the data is inserted into the database, I can create a scheduled job to run at the specified time every day? And to delete said scheduled job if it is past the finish data? I can figure out what the script needs to be, but I'm not sure what technologies to use to create/run/delete the scheduled job.
Help much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你必须在你的服务器上运行 cron 。
这是一些有用的文档。
http://net.tutsplus.com/tutorials/ php/managing-cron-jobs-with-php-2/
you have to run cron your server.
here is some useful document.
http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/
最好的选择是 cron jobs
这里有一些文档:
http://www.thesitewizard .com/general/set-cron-job.shtml
希望有帮助!
the best option would be cron jobs
here is some documentation:
http://www.thesitewizard.com/general/set-cron-job.shtml
hope that helps!