Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autoresponder timed messages

Status
Not open for further replies.

mancroft

Programmer
Joined
Oct 26, 2002
Messages
267
Location
GB
I am doing an autoresponder where a user types their email address into a form and then gets sent a response. I know how to do this.

But, in addition, I want to send further (different)messages automatically. Say, one a week later and another a week after that.

What is the best way to set the time for these messages in PHP?
 
May be you can use cron (in *IX) or its equivalent (task schedular?) in windows, for the purpose.

store the day (and time) the user has registered in database.Write a PHP (or perl or shell script) which sends the email, set a cron so that the script will be executed on specific days after the user has registered.

If the cron facility is not available by the host, write a piece of code in top of your php file which executes alomost daily.(i know you cant gurantee that) which checks if the todays date is 'n' number of days after the user has registered, from the database. if yes send an email. (Its an work around for cron, not so effective)

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
It's more effective than you think.

I have wuite a few PHP scripts that I have cron jobs and Windows boxes run scheduled commands.

The workaround in Windows is to have the the task kill itself in 1 minute.

Just schedule c:\Program Files\Internet Explorer\iexplore.exe
 
You could set the headers of a page such that it forced a refresh every 24 hours. Leave this page open in a browser on your server.

That would give you the "master clock" that you need... and you could perform your checks server-side... maybe loading a bunch of specific php files into frames (so that you can perform multiple tasks at the same time).

Just a thought :)

Jeff
 
The solution depends on your platform.
In the *NIX environment cron jobs are a great way, especially when you have a command line version of PHP.
As rrsub suggests there are workarounds for either *NIX and Windows by opening a browser at a specific time and browse to the URL (Lynx/IE).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top