Send reminder: 2 months, 1 month and one week before expiration date
I was wondering how I can send reminder to my users (via email) two mon开发者_StackOverflow中文版ths, a month and one week before their account expiration date (eg. $accountExp which is a unix timestamp)?
set up a cron job to run a php script that will fetch entries in this way e.g.
/* send those 2 months before exp date*/
$sql='select * FROM users WHERE exp_date_unix>='.(time()+86400*60);
or if you use the datetime/timestamp field
the condition would be smth like
DATE_DIFF(exp_date_unix, CURRENT_TIMESTAMP) >=60;
You'll need to set up a cron job to work out if an email needs to be sent and send it, and use the date_diff sql function to calculate what needs to be sent in the script
精彩评论