How to send Email on (repeating) time intervals in php

the mail() function

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: How to send Email on (repeating) time intervals in php

Post by egami » Mon Aug 08, 2011 5:40 am

php by itself can't do any cron jobs..
but you can set the cron to run a php script as little as every minute of the day.

For more information on cron jobs, do a google search.

your PHP script would have something to the effect of..

1. The current time
2. Search for all queries to run at current time with in a few seconds of 'the current time'
3. run your email routines against those queries that return.

rytec

Re: How to send Email on (repeating) time intervals in php

Post by rytec » Thu Sep 22, 2011 6:02 am

To make a php script for example in Linuxserver, doe sit need to have the php extension? or would this be a totaly normal script in linux which also can do a query to the mysql dbase?
which way is better?

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: How to send Email on (repeating) time intervals in php

Post by egami » Thu Sep 22, 2011 7:22 am

you would run it as root, but you call php application, and then the file..


example:

/5 * * * * root php /var/www/html/dome.php

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests