You are here

function mailhandler_cron in Mailhandler 6

Same name and namespace in other branches
  1. 5 mailhandler.module \mailhandler_cron()
  2. 7 mailhandler.module \mailhandler_cron()

Implementation of hook_cron().

Retrieve and process mesages from all enabled mailboxes.

Related topics

File

./mailhandler.module, line 29
Mailhandler module code.

Code

function mailhandler_cron() {

  // @todo: remove this include when the retriever gets decoupled.
  // @todo: add mailhandler_watchdog_record functions.
  module_load_include('inc', 'mailhandler', 'mailhandler.retrieve');

  // Get only enabled for cron mailboxes.
  $mailboxes = mailhandler_mailbox_load_multiple(array(), array(
    'enabled' => TRUE,
  ));

  // Process mailboxes.
  foreach ($mailboxes as $mid => $mailbox) {
    mailhandler_node_process_mailbox((array) $mailbox, 'auto');
  }
}