function bfox_bp_schedule_send_emails() { $limit = 500; // Send emails, $limit number of schedules at a time, until there are no more remaining while (BfoxReadingSchedule::send_emails($limit)) { // Clear the Reading Plan cache each time because we are dealing with large amounts of data BfoxReadingPlan::cache_clear(); } }