I have created a function to run a query and create a CSV file. The CSV file will be stored in a particular folder on my server. These files are distinguished by dates.
I want to schedule an event that will run every day and send me the appropriate file with the date as an email from WordPress
$today_date = date('d-m-Y');
$path = $_SERVER['DOCUMENT_ROOT'].'/wp-content/reports/daily-coupon-clicks/';
$filename = 'daily-coupon-clicks-'.$today_date.'.csv';
Couldn't figure out the set of code to do this?