You are here

function mail_debugger_callback_submit_contrib_mail in Mail Debugger 7.2

Send mail via contrib module

_state

Parameters

type $form:

1 string reference to 'mail_debugger_callback_submit_contrib_mail'
mail_debugger_callback in includes/mail_debugger.callback.inc
Callback for drupal_get_form

File

includes/mail_debugger.callback.inc, line 374

Code

function mail_debugger_callback_submit_contrib_mail($form, &$form_state) {

  // return to this page after submit
  user_variable_set('mail_debugger_default_tab', 'edit-contrib');
  if ($form_state['values']['contrib']['param']) {
    $param = array();
    try {
      $param = $form_state['values']['contrib']['param'];
    } catch (Exception $ex) {
      form_set_error('contrib][param', $ex
        ->getMessage());
    }
  }
  $module = $form_state['contrib']['module'];
  $key = $form_state['contrib']['key'];
  $to = $form_state['contrib']['to'];
  $language = $form_state['contrib']['language'];
  $key = $form_state['contrib']['key'];
  $from = $form_state['contrib']['from'];
  $send = $form_state['contrib']['send'];
  $result = drupal_mail($module, $key, $to, $language, $param, $from, $send);
  if ($result) {
    drupal_set_message('E-mail sent! Please check your mail.');
  }
  else {
    drupal_set_message('Something went wrong. Check the error logs to get more info.', 'warning');
  }
}