Send mail every n days

I have a PHP script that I use to send mail to clients. How can I execute this script every 5 days for example? Can anyone give me an idea or some links? Thanks to

+2


a source to share


6 answers


If you have a database at the bottom, you can store the date of the last letter in the database. The script then checks to see what the latest date is in your database. If it is more than n days in the past, it sends a new email and overwrites the date in the database with the current date.



Alternatively, you can just use Cron-jobs .

+2


a source


Use cron . Your file looks something like this: cronjob

* * */5 * * /usr/local/bin/php -q /www/scripts/myscript.php

      



That's pretty much it. Easy as pie!

+2


a source


I'm sure there are many methods you can use, so I'll tell you how I do it: I use cron , which is only available on Unix type servers.

0


a source


You can use a cron job. If your server has the capability.

http://en.wikipedia.org/wiki/Cron

Another option is to use an external service that runs your script once every five days.

0


a source


Your best bet is to create a cronjob .

If you cannot use cron on your webserver, get one and select the page using external tools.

You can also start a daemon that "sleeps" 5 days between each upload. *

0


a source


You need some kind of external trigger event.

Most likely a cron job to execute the task directly every n days, but since it looks like it could be a website, you can also have a cron job (or Windows task) that visits a predefined web page every n days and send the web -page by e-mail.

0


a source







All Articles