Skip to content
Jason Austin edited this page Aug 19, 2013 · 2 revisions

OTF comes with an email queue that can send email at a throttled rate. The email queue stores data in the tbl_emailqueue table.

To queue an email, you will use the Zend_Mail object.

$eq = new Ot_Model_DbTable_EmailQueue();

$mail = new Zend_Mail();

$mail->addTo($to);
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setBodyText($body);

$eData = array(
    'zendMailObject' => $mail,
    'attributeName'  => 'someAttributeName',
    'attributeId'    => $someAttributeId,
);

$eq->queueEmail($eData);

attributeName can be set to anything. Sometimes, you may want to associate a queued email with something else, like an account. In that case, attributeName would be accountId and attributeId would be the numeric account ID for the user. These can be any values, so it is up to you.

Cron Schedule

The cronjob that processes the Email Queue runs every minute and processes 20 emails at a time.

Clone this wiki locally