You are here

function simplenews_get_spool in Simplenews 6

Same name and namespace in other branches
  1. 6.2 includes/simplenews.mail.inc \simplenews_get_spool()
  2. 7.2 includes/simplenews.mail.inc \simplenews_get_spool()
  3. 7 includes/simplenews.mail.inc \simplenews_get_spool()

Retreive data from mail spool

Parameters

string $status Status of data to be retreived (0 = hold, 1 = pending, 2 = send):

integer $nid node id:

integer $vid node version id:

integer $limit The maximum number of mails to load from the spool:

Return value

array Mail message array $message['msid'] $message['mail'] $message['nid'] $message['vid'] $message['tid'] $message['status'] $message['time']

1 call to simplenews_get_spool()
simplenews_mail_spool in ./simplenews.module
Send simplenews newsletters from the spool.

File

./simplenews.module, line 1873
Simplnews node handling, sent email, newsletter block and general hooks

Code

function simplenews_get_spool($status, $nid = NULL, $vid = NULL, $limit = 999999) {
  $messages = array();
  $result = db_query_range("SELECT * FROM {simplenews_mail_spool} s WHERE s.status = %d ORDER BY s.timestamp ASC", $status, 0, $limit);
  while ($data = db_fetch_array($result)) {
    $message = array();
    foreach ($data as $key => $value) {
      $message[$key] = $value;
    }
    $messages[$data['msid']] = $message;
  }
  return $messages;
}