You are here

function mandrill_admin_settings_submit in Mandrill 6

Submission for the administrative settings form.

Parameters

form: An associative array containing the structure of the form.

form_state: A keyed array containing the current state of the form.

1 string reference to 'mandrill_admin_settings_submit'
mandrill_admin_settings in ./mandrill.admin.inc
Administrative settings.

File

./mandrill.admin.inc, line 133
Administrative forms for Mandrill module.

Code

function mandrill_admin_settings_submit($form, &$form_state) {
  $values = $form_state['values'];
  $mail_inc = drupal_get_path('module', 'mandrill') . '/mandrill.mail.inc';
  switch ($form_state['values']['mandrill_status']) {
    case MANDRILL_STATUS_ON:
      variable_set('smtp_library', $mail_inc);
      drupal_set_message(t('Mandrill will be used to deliver all site emails.'));
      watchdog('mandrill', 'Mandrill has been enabled.');
      break;
    case MANDRILL_STATUS_TEST:
      variable_set('smtp_library', $mail_inc);
      drupal_set_message(t('Mandrill will be used in test mode. Emails will not actually be sent, just logged.'));
      watchdog('mandrill', 'Mandrill has been placed in test mode.');
      break;
    case MANDRILL_STATUS_OFF:
      if (variable_get('smtp_library', '') == $mail_inc) {
        variable_del('smtp_library');
      }
      drupal_set_message(t('The default mail system will be used to deliver all site emails.'));
      watchdog('mandrill', 'Mandrill has been disabled.');
      break;
  }
}