You are here

function mail_debugger_callback_submit_custom_mail in Mail Debugger 7.2

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

Form submit handler

_state

Parameters

array $form:

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

File

includes/mail_debugger.callback.inc, line 267

Code

function mail_debugger_callback_submit_custom_mail($form, &$form_state) {

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

  // Load setup
  $opts = (object) $form_state['values']['custom'];

  // Send the mail
  $mail = drupal_mail('mail_debugger', 'custom_mail', $opts->to, NULL, array(
    'body' => $opts->body,
    'subject' => $opts->subject,
  ));

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