How to send Recurring Monthly,Weekly emails based on date in php
I need to send recurring emails for every month,week according to user subscription,while sending mails i have to calculate date intervals from registered date.
I have used below code,
$30_day_query = "SELECT * FROM users WHERE reminder = 1 AND date BETWEEN DATE_SUB(NOW(),INTERVAL 29 DAY) AND DATE_SUB(NOW(), INTERVAL 30 DAY)";
This query work for sending the email out every 30 days after the initial Date of Service,
I have planned to run this in Cron.
Please Suggest.Thanks in Advance!
Here is an example of what to put in your crontab file to run the script every monday at midnight.
# crontab -e 0 0 * * 1 /usr/local/bin/php /home/ryan/myscript.php
You can generate any cron sequence you need at this website: http://www.webmaster-toolkit.com/cron-generator.shtml