'', 'subject' => '', 'message_html' => '', 'message_plaintext' => '', 'attachments' => ''); $form['settings']['from'] = array( '#type' => 'textfield', '#title' => t('Sender'), '#default_value' => $settings['from'], '#description' => t("The mail's from address. Leave it empty to use the site-wide configured address."), ); $form['settings']['subject'] = array( '#type' => 'textfield', '#title' => t('Subject'), '#default_value' => $settings['subject'], '#description' => t("The mail's subject."), ); $form['settings']['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".'), ); } /** * Action "Send an HTML mail to an arbitrary mail address" configuration form. */ function mimemail_rules_action_mail_form($settings = array(), &$form) { $settings += array('to' => '', 'cc' => '', 'bcc' => ''); $form['settings']['to'] = array( '#type' => 'textfield', '#title' => t('Recipient'), '#default_value' => $settings['to'], '#description' => t("The mail's recipient address. You may separate multiple addresses with comma."), '#required' => TRUE, '#weight' => -1, ); $form['settings']['cc'] = array( '#type' => 'textfield', '#title' => t('CC Recipient'), '#default_value' => $settings['cc'], '#description' => t("The mail's carbon copy address. You may separate multiple addresses with comma."), '#required' => FALSE, '#weight' => 0, ); $form['settings']['bcc'] = array( '#type' => 'textfield', '#title' => t('BCC Recipient'), '#default_value' => $settings['bcc'], '#description' => t("The mail's blind carbon copy address. You may separate multiple addresses with comma."), '#required' => FALSE, '#weight' => 0, ); mimemail_rules_action_mail_to_user_form($settings, $form); } /** * Action "Send an HTML mail to users of a role" configuration form. */ function mimemail_rules_action_mail_to_users_of_role_form($settings = array(), &$form) { // Select only non-anonymous user roles because anonymous users won't have emails. $roles = array_map('filter_xss_admin', user_roles(TRUE)); $form['settings']['recipients'] = array( '#type' => 'checkboxes', '#title' => t('Recipient roles'), '#prefix' => t('WARNING! This may cause problems if there are too many users of these roles on your site, as your server may not be able to handle all the mail requests all at once.'), '#required' => TRUE, '#default_value' => isset($settings['recipients']) ? $settings['recipients'] : array(), '#options' => $roles, '#description' => t('Select the roles whose users should receive this mail.'), ); mimemail_rules_action_mail_to_user_form($settings, $form); } /** * @} */