function mandrill_test_form_submit in Mandrill 6
Same name and namespace in other branches
- 7.2 mandrill.admin.inc \mandrill_test_form_submit()
 - 7 mandrill.admin.inc \mandrill_test_form_submit()
 
Submit handler for mandrill_test_form(), sends the test email.
_state
Parameters
string $form:
Return value
void
File
- ./
mandrill.admin.inc, line 209  - Administrative forms for Mandrill module.
 
Code
function mandrill_test_form_submit($form, &$form_state) {
  // If an address was given, send a test email message.
  $test_address = $form_state['values']['mandrill_test_address'];
  global $language;
  $params['subject'] = t('Drupal Mandrill test email');
  $params['body'] = $form_state['values']['mandrill_test_body'];
  $params['include_attachment'] = $form_state['values']['include_attachment'];
  $result = drupal_mail('mandrill', 'mandrill-test', $test_address, $language, $params, variable_get('mandrill_from', ''));
  if (isset($result['result']) && $result['result'] === true) {
    drupal_set_message(t('A test email has been sent to @email.', array(
      '@email' => $test_address,
    )));
  }
}