开发者

Send email at automated times stored in database

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    | user@example.com  | 20111008  | 20111015 | 1630
User 2    | bob2@example.com  | 20111011  | 2011102开发者_如何学C5 | 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!


you have to run cron your server. here is some useful document.

http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/


the best option would be cron jobs

here is some documentation:

http://www.thesitewizard.com/general/set-cron-job.shtml

hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜