You are here

function email_contact_mail_page_form_validate in Email Contact 7

Validate the site-wide contact page form submission.

1 string reference to 'email_contact_mail_page_form_validate'
email_contact_mail_page_form in ./email_contact.module
Contact form.

File

./email_contact.module, line 404
File name: email_contact.module.

Code

function email_contact_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: @subject', array(
      '@subject' => $form_state['values']['subject'],
    ), WATCHDOG_NOTICE);
  }
}