You are here

function mimemail_send_email_action_form in Mime Mail 7

Form for configurable Drupal action to send an HTML mail.

File

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

Code

function mimemail_send_email_action_form($context) {
  $context += array(
    'key' => '',
    'to' => '',
    'cc' => '',
    'bcc' => '',
    'reply-to' => '',
    'subject' => '',
    'body' => '',
    'format' => filter_fallback_format(),
    'plaintext' => '',
    'attachments' => '',
  );
  $form['key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => $context['key'],
    '#description' => t('A key to identify the e-mail sent.'),
    '#required' => TRUE,
  );
  $form['to'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipient'),
    '#default_value' => $context['to'],
    '#maxlength' => 254,
    '#description' => t('The email address to which the message should be sent OR enter [node:author:mail], [comment:author:mail], etc. if you would like to send an e-mail to the author of the original post.'),
    '#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 subject of the message."),
  );
  $form['body'] = array(
    '#type' => 'text_format',
    '#title' => t('Body'),
    '#default_value' => $context['body'],
    '#format' => $context['format'],
    '#description' => t('The HTML message that should be sent. You may include placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
  );
  $form['plaintext'] = array(
    '#type' => 'textarea',
    '#title' => t('Plain text body'),
    '#default_value' => $context['plaintext'],
    '#description' => t('Optional plaintext portion of a multipart message. You may include placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
  );
  $form['attachments'] = array(
    '#type' => 'textarea',
    '#title' => t('Attachments'),
    '#default_value' => $context['attachments'],
    '#description' => t('A list of attachments, one file per line e.g. "files/images/mypic.png" without quotes.'),
  );
  return $form;
}