You are here

function mimemail_send_mail_action_form in Mime Mail 6

Form for configurable Drupal action to send an HTML mail.

File

modules/mimemail_action/mimemail_action.module, line 113
Provide actions for the Mime Mail module.

Code

function mimemail_send_mail_action_form($context) {
  $context += array(
    'key' => '',
    'to' => '',
    'cc' => '',
    'bcc' => '',
    'reply_to' => '',
    'subject' => '',
    'message_html' => '',
    'message_html_filter' => FILTER_FORMAT_DEFAULT,
    'message_plaintext' => '',
    'attachments' => '',
  );
  $form['key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => $context['key'],
    '#description' => t("An identifier for the message."),
    '#required' => TRUE,
  );
  $form['to'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipient'),
    '#default_value' => $context['to'],
    '#maxlength' => 254,
    '#description' => t("The mail's recipient address. You may separate multiple addresses with comma and use %author if the recipient is the author of the original post.", array(
      '%author' => '%author',
    )),
    '#required' => TRUE,
  );
  $form['cc'] = array(
    '#type' => 'textfield',
    '#title' => t('CC Recipient'),
    '#default_value' => $context['cc'],
    '#description' => t("The mail's carbon copy address. You may separate multiple addresses with comma."),
    '#required' => FALSE,
  );
  $form['bcc'] = array(
    '#type' => 'textfield',
    '#title' => t('BCC Recipient'),
    '#default_value' => $context['bcc'],
    '#description' => t("The mail's blind carbon copy address. You may separate multiple addresses with comma."),
    '#required' => FALSE,
  );
  $form['reply_to'] = array(
    '#type' => 'textfield',
    '#title' => t('Reply e-mail address'),
    '#default_value' => $context['reply_to'],
    '#description' => t("The address to reply to. Leave it empty to use the sender's address."),
    '#required' => FALSE,
  );
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#maxlength' => 254,
    '#default_value' => $context['subject'],
    '#description' => t("The mail's subject."),
  );
  $form['message_html_filter']['message_html'] = array(
    '#type' => 'textarea',
    '#title' => t('HTML message'),
    '#default_value' => $context['message_html'],
    '#description' => t("The message body in HTML format. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts."),
  );
  $form['message_plaintext'] = array(
    '#type' => 'textarea',
    '#title' => t('Text message'),
    '#default_value' => $context['message_plaintext'],
    '#description' => t("Optional plaintext portion of a multipart message."),
  );
  $form['attachments'] = array(
    '#type' => 'textarea',
    '#title' => t('Attachments'),
    '#default_value' => $context['attachments'],
    '#description' => t('A list of attachments, one file per line like [mimetype]:[path] e.g. "image/png:/files/images/mypic.png" without quotes.'),
  );
  $form['message_html_filter']['format'] = filter_form($context['message_html_filter']);
  return $form;
}