You are here

function mail_debugger_callback_submit_user_mail in Mail Debugger 7.2

Same name and namespace in other branches
  1. 7 includes/mail_debugger.callback.inc \mail_debugger_callback_submit_user_mail()

Form submit handler

_state

Parameters

array $form:

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

File

includes/mail_debugger.callback.inc, line 227

Code

function mail_debugger_callback_submit_user_mail($form, &$form_state) {

  // return to this page after submit
  user_variable_set('mail_debugger_default_tab', 'edit-user');

  // where to send the mail to?
  $values = $form_state['values']['user'];

  // load the user account
  $account = user_load_by_mail($values['mail']);

  // send the mail
  $result = _user_mail_notify($values['type'], $account);

  // Notify about the result
  if ($result) {
    drupal_set_message(t('Message sent'));
  }
  else {
    drupal_set_message(t('Message sent with errors. Check the error log.'), 'warning');
  }
}