You are here

function htmlmail_test_form_submit in HTML Mail 7

Same name and namespace in other branches
  1. 8.2 htmlmail.admin.inc \htmlmail_test_form_submit()
  2. 5 htmlmail.module \htmlmail_test_form_submit()
  3. 6.2 htmlmail.admin.inc \htmlmail_test_form_submit()
  4. 6 htmlmail.admin.inc \htmlmail_test_form_submit()
  5. 7.2 htmlmail.admin.inc \htmlmail_test_form_submit()

Sends the test messsage and saves the contents for re-use.

File

./htmlmail.admin.inc, line 180
Admin forms for HTML Mail

Code

function htmlmail_test_form_submit($form, &$form_state) {

  // Get the form values.
  $defaults = array(
    'to' => $form_state['values']['to'],
    'subject' => $form_state['values']['subject'],
    'body' => $form_state['values']['body'],
  );

  // Save the defaults for reuse.
  variable_set('htmlmail_test', $defaults);

  // Send the email.
  $params = array(
    'subject' => $form_state['values']['subject'],
    'body' => check_markup($form_state['values']['body']['value'], $form_state['values']['body']['format']),
  );
  if (drupal_mail('htmlmail', 'test', $form_state['values']['to'], language_default(), $params)) {
    drupal_set_message(t('HTML Mail test message sent.'));
  }
}