
Sendex
Component for email newsletters. Written as a demo of MODX component development


To send a newsletter, add messages to the queue first.



You can send in several ways:
Manually. Components → Sendex, Email queue tab. Select a message and send via the context menu. 
Automatically via cron. Use core/components/sendex/cron/send.php in cron. Run frequency depends on subscriber count and hosting; the script sends up to 100 emails per run. Sent messages are removed from the queue.
Via API.
$modx->addPackage('sendex', MODX_CORE_PATH . 'components/sendex/model/');
$q = $modx->newQuery('sxQueue');
$queue = $modx->getCollection('sxQueue');
/** @var sxQueue $email */
foreach ($queue as $email) {
$email->send();
}