You are here

function email_mail_page_form_validate in Email Field 6

Same name and namespace in other branches
  1. 5 email.module \email_mail_page_form_validate()
  2. 6.2 email.module \email_mail_page_form_validate()
  3. 7 email.module \email_mail_page_form_validate()

Validate the site-wide contact page form submission.

1 string reference to 'email_mail_page_form_validate'
email_mail_page_form in ./email.module
Contact form

File

./email.module, line 377

Code

function email_mail_page_form_validate($form, &$form_state) {
  if (!valid_email_address($form_state['values']['mail'])) {
    form_set_error('mail', t('You must enter a valid e-mail address.'));
  }
  if (preg_match("/\r|\n/", $form_state['values']['subject'])) {
    form_set_error('subject', t('The subject cannot contain linebreaks.'));
    watchdog('mail', 'Email injection exploit attempted in email form subject: ' . check_plain($form_state['values']['subject']), WATCHDOG_NOTICE);
  }
}