[PHP] Timed Jobs.

2002-02-20 Thread webmaster mbtradingco








Hi:



I was wondering if it is posible to make in PHP a cron
job, that will trigger an event (i.e. send an e-mail) long after the process of
the data has taken place, like programming an e-mail to go out, on an specified
date.



My question is, since the script is run and triggered
by the user, how can u trigger the later sending of the mail?



Thanks.








Re: [PHP] Timed Jobs.

2002-02-20 Thread Steve Werby

Argh!  Please drop the purple bakground from your email.  HTML email is bad
enough since many of us use mail readers that can't read it, but black on
purple is just plain hard to look at!


webmaster mbtradingco [EMAIL PROTECTED] wrote:
 I was wondering if it is posible to make in PHP a cron job, that will
 trigger an event (i.e. send an e-mail) long after the process of the
 data has taken place, like programming an e-mail to go out, on an
 specified date.

I recommend inserting the data into a database (perhaps MySQL) which
includes the email data, recipients and date/time to send.  Then setup a
cron job which to run every X minutes which checks for pending emails, runs
them after the date/time has been reached and either deletes the records
when complete, moves them to a different table or changes a status flag so
the next query won't process the same records.  Personally, I'd install PHP
as a CGI to do it, but if you can't or want to avoid that you could use wget
or lynx to call the script over the web (of course you could always use perl
or your favorite scripting language).  If you do that, you should consider
password protecting the script so others can't access it.  Others accessing
it may not be a security risk, but it could add load you don't want.  Both
lynx and wget allow you to pass a HTTP user/password.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php