You are here

function views_send_deliver in Views Send 6

Same name and namespace in other branches
  1. 8 views_send.module \views_send_deliver()
  2. 7 views_send.module \views_send_deliver()

Sending the message take from spool.

Parameters

$message: Database object containing the spooled message being send.

Return value

Boolean indicating if the message was sent successfully.

1 call to views_send_deliver()
views_send_send_from_spool in ./views_send.cron.inc
Process the spool queue at cron run.

File

./views_send.cron.inc, line 77
Views Send cron rotuines.

Code

function views_send_deliver($message) {
  $headers = unserialize($message->headers);
  $to = _views_send_format_address($message->to_mail, $message->to_name);
  $from = _views_send_format_address($message->from_mail, $message->from_name);

  /**
   * FIXME:
   * If _views_send_prepare_mail in the future is extended to use non-fixed mail keys,
   * this needs to be mirrored here. Currently we just insert the same fixed message ID.
   */
  $key = 'direct';
  if (VIEWS_SEND_MIMEMAIL) {
    $mail = array(
      'address' => $to,
      'subject' => mime_header_encode($message->subject),
      'body' => $message->body,
      'sender' => $from,
      'headers' => $headers,
      'id' => 'views_send_' . $key,
    );
    return mimemail_send_message($mail);
  }
  else {
    $mail = array(
      'to' => $to,
      'subject' => $message->subject,
      'body' => $message->body,
      'from' => $from,
      'headers' => $headers,
      'id' => 'views_send_' . $key,
    );
    return drupal_mail_send($mail);
  }
}