You are here

function reroute_email_settings_validate in Reroute Email 6

Validation callback for reroute_email_settings() form.

File

./reroute_email.admin.inc, line 37
Reroute Email admin configuration functions.

Code

function reroute_email_settings_validate($form, $form_state) {
  if ($form_state['values']['reroute_email_enable'] == TRUE) {

    // Allow splitting emails by space, comma, semicolon.
    $addresslist = preg_split(REROUTE_EMAIL_EMAIL_SPLIT_RE, $form_state['values']['reroute_email_address'], -1, PREG_SPLIT_NO_EMPTY);
    foreach ($addresslist as $address) {
      if (!valid_email_address($address)) {
        form_set_error('reroute_email_address', t('@address is not a valid email address', array(
          '@address' => $address,
        )));
      }
    }
  }
}