You are here

function htmlmail_test_form in HTML Mail 7.2

Same name and namespace in other branches
  1. 8.2 htmlmail.admin.inc \htmlmail_test_form()
  2. 5 htmlmail.module \htmlmail_test_form()
  3. 6.2 htmlmail.admin.inc \htmlmail_test_form()
  4. 6 htmlmail.admin.inc \htmlmail_test_form()
  5. 7 htmlmail.admin.inc \htmlmail_test_form()

Builds a form for sending a test message.

1 string reference to 'htmlmail_test_form'
htmlmail_menu in ./htmlmail.module
Implements hook_menu().

File

./htmlmail.admin.inc, line 239
Admin forms for HTML Mail.

Code

function htmlmail_test_form($form, &$form_values) {
  $defaults = variable_get('htmlmail_test', array(
    'to' => variable_get('site_mail', 'user@example.com'),
    'subject' => 'test',
    'body' => array(
      'value' => 'test',
    ),
  ));
  if (empty($defaults['body']['format'])) {
    $defaults['body']['format'] = filter_fallback_format();
  }
  $form['to'] = array(
    '#type' => 'textfield',
    '#title' => t('To'),
    '#default_value' => $defaults['to'],
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => $defaults['subject'],
    '#maxlength' => 128,
    '#required' => TRUE,
  );
  $form['body'] = array(
    '#type' => 'text_format',
    '#title' => t('Body'),
    '#rows' => 20,
    '#default_value' => $defaults['body']['value'],
    '#format' => $defaults['body']['format'],
    '#required' => TRUE,
  );
  $mailsystem = mailsystem_get();
  if (empty($mailsystem['htmlmail'])) {
    $mailsystem['htmlmail'] = 'HTMLMailSystem';
  }
  $form['class'] = array(
    '#type' => 'select',
    '#title' => t('Test mail sending class'),
    '#default_value' => $mailsystem['htmlmail'],
    '#options' => array_combine(mailsystem_get_classes(), mailsystem_get_classes()),
    '#description' => t('Select the MailSystemInterface implementation to be tested.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send test message'),
  );
  return $form;
}