开发者

Send reminder: 2 months, 1 month and one week before expiration date

开发者 https://www.devze.com 2023-04-07 14:20 出处:网络
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 timesta

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号