View source
<?php
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);
}