You are here

queue_mail.module in Queue Mail 6

Same filename and directory in other branches
  1. 8 queue_mail.module
  2. 5 queue_mail.module
  3. 7 queue_mail.module

File

queue_mail.module
View source
<?php

/**
 * Email sending function, called from job queue, or as a fallback.
 */
function queue_mail_send($message = array()) {
  $mimeheaders = array();
  foreach ($message['headers'] as $name => $value) {
    $mimeheaders[] = $name . ': ' . mime_header_encode($value);
  }
  return mail($message['to'], mime_header_encode($message['subject']), str_replace("\r", '', $message['body']), join("\n", $mimeheaders));
}
function queue_mail_menu() {
  $items = array();
  $items['admin/settings/queue_mail'] = array(
    'title' => 'Queue Mail',
    'description' => 'Set queue priorities.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'queue_mail_settings_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
  );
  return $items;
}
function queue_mail_settings_form() {
  $form['queue_mail_keys'] = array(
    '#type' => 'textarea',
    '#title' => t('Mailkeys'),
    '#description' => t('Enter each $mailkey separated by commas. To delete mailkeys, delete it from the textbox and submit form.') . '<br/>' . t('To find mail keys, use the second parameter in drupal_mail, e.g. user_mail, register_pending_approval_admin'),
    '#default_value' => variable_get('queue_mail_keys', ''),
  );
  $form['queue_mail_priority'] = array(
    '#type' => 'select',
    '#default_value' => variable_get('queue_mail_priority', 'immediate'),
    '#description' => t('All mailkeys entered above will be set to immediate. That is, the mail will be sent immediately.'),
    '#title' => t('Priority'),
    '#options' => array(
      'immediate',
    ),
    '#disabled' => TRUE,
  );
  return system_settings_form($form);
}

Functions

Namesort descending Description
queue_mail_menu
queue_mail_send Email sending function, called from job queue, or as a fallback.
queue_mail_settings_form