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!

Answers


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


Need Your Help

Object doesn't support trim method in IE8

javascript jquery object methods internet-explorer-8

I've written a form validation through javascript and it works on all browsers except for ie8. the error I am seeing in IE8 says: Object doesn't support this property or method and points to the l...

How does one convert from CString to unsigned char* with Unicode?

visual-studio visual-studio-2008 visual-c++ string

I'm trying to do something simple here. When I execute the following code in Visual Studio 2008 using the unicode character set, xmlString is correct.