/**
  * Write Notice
  *
  * @param string $message
  * @param string $source
  * @param string $category
  * @param array $attributes
  * @return void
  */
 public static function writeNotice($message, $source = 'default', $category = 'default', array $attributes = array())
 {
     $log = CjwNewsletterLog::getInstance();
     $log->source = $source;
     $log->category = $category;
     $log->log($message, ezcLog::NOTICE, $attributes);
 }
 *
 * - search all cjwnl_edition_send_items, which are not send
 * - process every cjwnl_edition_send_item separatly
 * - generate the newsletter with personal user data (unsubsribe link, configure link, personalisation ... )
 * - send newsletter via mail + set status to SEND
 * - mutex support (no double execute of cronjobs)->integrate in runcronjobs.php
 *
 * @copyright Copyright (C) 2007-2010 CJW Network - Coolscreen.de, JAC Systeme GmbH, Webmanufaktur. All rights reserved.
 * @license http://ez.no/licenses/gnu_gpl GNU GPL v2
 * @version //autogentag//
 * @package cjw_newsletter
 * @subpackage cronjobs
 * @filesource
 */
// to fetch instance in Cli mode for separate logdata, cause access rights phpcli + webserver
$logInstance = CjwNewsletterLog::getInstance(true);
$message = "START: cjw_newsletter_mailqueue_process";
$cli->output($message);
// to fetch all send objetc with status == STATUS_MALQUEUE_CREATED || STATUS_MALQUEUE_STARTED
$sendObjectList = CjwNewsletterEditionSend::fetchEditionSendListByStatus(array(CjwNewsletterEditionSend::STATUS_MAILQUEUE_CREATED, CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_STARTED));
// - count all + how much should send?
// - if send = 0 at first element status == STATUS_MALQUEUE_STARTED
// - if send = count all => status == PROCESS_FINISHED
foreach ($sendObjectList as $sendObject) {
    // set startdate only at the first time
    if ($sendObject->attribute('status') == CjwNewsletterEditionSend::STATUS_MAILQUEUE_CREATED) {
        // if ok, set status == STATUS_MAILQUEUE_PROCESS_STARTED
        $sendObject->setAttribute('status', CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_STARTED);
        $sendObject->store();
        $message = "Status set: editonSend  STATUS_MAILQUEUE_PROCESS_STARTED";
        $cli->output($message);