stevepatd Posted December 20, 2007 Share Posted December 20, 2007 I have a program for a client where their users reserve a timeslot (appointment). I would like to have the program send the user an email the day or two before the appointed time. I don't want to have the administrator of this program go in and run a function to send emails, if any, every day. I would like it to be automatic. But the only way I see this happening is to write a program that is an infinite loop that may pause for many hours at a time and then wake up and check to see if any have to be sent out. But then if the server ever goes down the program exits and someone would have to restart it. How do I get a program to run in the background and send periodic emails when it is appropriate? Quote Link to comment https://forums.phpfreaks.com/topic/82440-infinite-loop-email-program/ Share on other sites More sharing options...
trq Posted December 20, 2007 Share Posted December 20, 2007 Set up a cron job to execute a php script every day. This php script would then find appointments for two days time and send them a reminder. Quote Link to comment https://forums.phpfreaks.com/topic/82440-infinite-loop-email-program/#findComment-419201 Share on other sites More sharing options...
meman1188 Posted December 20, 2007 Share Posted December 20, 2007 yea cron job is the way to go. if on windows, can set up a scheduled task.. basically same thing loop won't work.. eventually the script will timeout Quote Link to comment https://forums.phpfreaks.com/topic/82440-infinite-loop-email-program/#findComment-419382 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.