Program/Script (in my case, I'm using XAMPP): C:\xampp\php\php.exe
Arguments: C:/xampp/htdocs/backoffice/cron/mod-emailqueue-cron.php
- Double click the task and a property window will show up.
- Click the Triggers tab.
- Double click the trigger details and the Edit Trigger window will show up.
- Under Advance settings panel, tick Repeat task every xxx minutes, and set Indefinitely if you need.
- Finally, click ok.
howtogeek website, learn how to use crontab
* * * * * php -f /opt/lampp/htdocs/backoffice/cron/mod-emailqueue-cron.php
1) Start a new object
$email = new c1_emailqueue();
2) Get all your email settings,
$settings = c1_emailqueue::getSettings();
$email->set_field_settings(json_encode($settings));
2.1) You can recreate this ARRAY with other settings for specific cases and give him to email object,
$email->set_field_settings(json_encode($your_settings_array));
3) Set all attributes you need,
$email->setFrom($settings['server_email']);
$email->setTo('[email protected]');
$email->setCc('[email protected]; [email protected]'); // not mandatory
$email->setBcc('[email protected]; [email protected]'); // not mandatory
$email->setSubject('Give me a subject');
$email->setContent('Some content here!'); // give him HTML ;) it works very well
$email->setAttachments([
'uploads/file_1.jpg',
'uploads/file_2.txt'
]); // doesn't forget the size limit of your email service
$email->setPriority(10); // use if you want some priority over other emails on the pool (Default: 0)
$email->setStatus(); // not mandatory (Default: false or 0)
4) Send to the email pool and the cron will do the rest.
if ($email->insert()) {
// do something, or alert the user with a success message
} else {
// do something, or alert the user with a error message
// in this case don't forget, give developer an alert
}
- Update method;
- Exceptions;
- Data control;