concrete5 allows developers to create special jobs to run automatically via scheduled tasks on the server. These jobs can be any sort of action that you wish to perform automatically on a regular basis. In this recipe, we will write a job that will send a good morning e-mail to every user on the website.
It probably should go without saying, but please make sure to perform this recipe on a test server with test users and e-mail addresses. You don't want to annoy your entire user base with silly e-mails every morning.
The steps for creating a custom scheduled job are as follows:
Create a new file at
/jobs/email_everyone.php
.Declare a new class called
EmailEveryone
:class EmailEveryone extends Job { }
Create a method in the class to return the job's name:
public function getJobName() { return 'Wakeup Email'; }
Create another method to return the job's description:
public function getJobDescription() { return 'Give all of your site members...