You are here

function mimemail_example_form in Mime Mail 7

The example email contact form.

1 string reference to 'mimemail_example_form'
mimemail_example_menu in modules/mimemail_example/mimemail_example.module
Implements hook_menu().

File

modules/mimemail_example/mimemail_example.module, line 46
Core and contrib hook implementations for Mime Mail Example module.

Code

function mimemail_example_form() {
  global $user;
  $form['intro'] = array(
    '#markup' => t('Use this form to send a HTML message to an e-mail address. No spamming!'),
  );
  $form['key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => 'test',
    '#required' => TRUE,
  );
  $form['to'] = array(
    '#type' => 'textfield',
    '#title' => t('To'),
    '#default_value' => $user->mail,
    '#required' => TRUE,
  );
  $form['from'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender name'),
  );
  $form['from_mail'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender e-mail address'),
  );
  $form['params'] = array(
    '#tree' => TRUE,
    'headers' => array(
      'Cc' => array(
        '#type' => 'textfield',
        '#title' => t('Cc'),
      ),
      'Bcc' => array(
        '#type' => 'textfield',
        '#title' => t('Bcc'),
      ),
      'Reply-to' => array(
        '#type' => 'textfield',
        '#title' => t('Reply to'),
      ),
      'List-unsubscribe' => array(
        '#type' => 'textfield',
        '#title' => t('List-unsubscribe'),
      ),
    ),
    'subject' => array(
      '#type' => 'textfield',
      '#title' => t('Subject'),
    ),
    'body' => array(
      '#type' => 'textarea',
      '#title' => t('HTML message'),
    ),
    'plain' => array(
      '#type' => 'hidden',
      '#states' => array(
        'value' => array(
          ':input[name="body"]' => array(
            'value' => '',
          ),
        ),
      ),
    ),
    'plaintext' => array(
      '#type' => 'textarea',
      '#title' => t('Plain text message'),
    ),
    'attachments' => array(
      '#name' => 'files[attachment]',
      '#type' => 'file',
      '#title' => t('Choose a file to send as attachment'),
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send message'),
  );
  return $form;
}