Monitor Date And Send Email Notification To Users

- 1 answer

I have created a plugin in OctoberCMS to store users information and products expiry date.

I want to make Event fire when expiry date is close to current date and send email to the user, how can I monitor the date (should I use contrib shell command)? how do I approach this?




Probably you need cron-jobs

Server will execute scheduler based on time you define in your cron-job, In Your case it will be good to schedule it every day.

now every day it will fire you scheduler > then it will call your Task ( with your logic.


You will fetch records with condition like :

current_date + 1/2/3 day convert that date in to timestamp and store to variable future_date

And add condition on field expiry_date

expiry_date > today_time_stamp AND expiry_date < future_date

It will give you records which are about to expire in next 1/2/3 days

now notify [send email] or fire event for these records

You can add master cron job to your server just follow this guide

Then you can just write you logic how you want thing to be done

if any doubt please comment