You are here

function smtp_admin_settings_validate in SMTP Authentication Support 7

Same name and namespace in other branches
  1. 6 smtp.module \smtp_admin_settings_validate()
  2. 7.2 smtp.admin.inc \smtp_admin_settings_validate()

Validation for the administrative settings form.

File

./smtp.admin.inc, line 276
Administrative page code for the smtp module.

Code

function smtp_admin_settings_validate($form, &$form_state) {
  if ($form_state['values']['smtp_on'] == 1 && $form_state['values']['smtp_host'] == '') {
    form_set_error('smtp_host', t('You must enter a SMTP server address.'));
  }
  if ($form_state['values']['smtp_on'] == 1 && $form_state['values']['smtp_port'] == '') {
    form_set_error('smtp_port', t('You must enter a SMTP port number.'));
  }
  if ($form_state['values']['smtp_from'] && !valid_email_address($form_state['values']['smtp_from'])) {
    form_set_error('smtp_from', t('The provided from e-mail address is not valid.'));
  }
}