I want to create a script that can be run daily(as cron job?) and which does the following:

1) Queries a MySQL database to return details of registered users.
2) For each user, compares their expiry date with today's date and if the remaining period is either 30,14,7,3,2 or 1 days sends them an email to say that their subscription will expire in 'n' days.

The main application uses MySQL & PHP, but I'm assuming I'd need a shell script in this case.

Any help gratefully received.



You can use some auto responder.