reeseslover531 wrote:Hello guys. I am PHP5 newb here, so I hope you can bare with me. I am writing an event planning application. I have people signing up for certain events in the future. To remind them I want an email sent to them automaticlly a day before the event. Is this possible with php and what would the code be?
Thanks!
There are basically two options. You can setup a cron job in linux or create a "poor man's cron".
The "poor man's cron" is basically a script that runs at the top of your website that checks the dates of the events every time the page is loaded and and sends an e-mail to the attendees if the date is 1 day from the present date. Then you would have to set a flag that says the e-mail was sent (This option is only good if you have at least 1 hit a day because the website has to be loaded to run).
A regular "cron job" is the best way to do it because the OS runs the timing and nobody has to intervene or run the script manually to get it to run. It's a little hard to explain how to run a cron job in a short post, but basically it is a timed event that your linux server runs at specified intervals. The cron runs a php file at the time/date you choose and does whatever the php file says.
Try these links for assistance on setting up a cron job:
http://www.ez-response.com/howcronworks.htm
http://www.unixgeeks.org/security/newbie/unix/cron-1.html