You are here

function mimemail_rules_action_mail_to_user_form in Mime Mail 6

Action "Send an HTML mail to a user" configuration form.

2 calls to mimemail_rules_action_mail_to_user_form()
mimemail_rules_action_mail_form in includes/mimemail.rules_forms.inc
Action "Send an HTML mail to an arbitrary mail address" configuration form.
mimemail_rules_action_mail_to_users_of_role_form in includes/mimemail.rules_forms.inc
Action "Send an HTML mail to users of a role" configuration form.

File

includes/mimemail.rules_forms.inc, line 14
Rules actions for sending MIME-encoded e-mails (settings forms).

Code

function mimemail_rules_action_mail_to_user_form($settings = array(), &$form) {
  $settings += array(
    'key' => '',
    'sender' => '',
    'from' => '',
    'reply_to' => '',
    'subject' => '',
    'message_html' => '',
    'message_html_filter' => FILTER_FORMAT_DEFAULT,
    'message_plaintext' => '',
    'attachments' => '',
  );
  $form['settings']['key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => $settings['key'],
    '#description' => t("An identifier for the message."),
    '#required' => TRUE,
  );
  $form['settings']['sender'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender name'),
    '#default_value' => $settings['sender'],
    '#description' => t("The sender's name. Leave it empty to use the site-wide configured name."),
  );
  $form['settings']['from'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender e-mail address'),
    '#default_value' => $settings['from'],
    '#description' => t("The sender's address. Leave it empty to use the site-wide configured address."),
  );
  $form['settings']['reply_to'] = array(
    '#type' => 'textfield',
    '#title' => t('Reply e-mail address'),
    '#default_value' => $settings['reply_to'],
    '#description' => t("The address to reply to. Leave it empty to use the sender's address."),
  );
  $form['settings']['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => $settings['subject'],
    '#description' => t("The mail's subject."),
  );
  $form['settings']['message_html_filter']['message_html'] = array(
    '#type' => 'textarea',
    '#title' => t('HTML message'),
    '#default_value' => $settings['message_html'],
    '#description' => t("The message body in HTML format."),
  );
  $form['settings']['message_plaintext'] = array(
    '#type' => 'textarea',
    '#title' => t('Text message'),
    '#default_value' => $settings['message_plaintext'],
    '#description' => t("Optional plaintext portion of a multipart message."),
  );
  $form['settings']['attachments'] = array(
    '#type' => 'textarea',
    '#title' => t('Attachments'),
    '#default_value' => $settings['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['settings']['message_html_filter']['format'] = filter_form($settings['message_html_filter']);
}