You are here

function email_mail_page_form_validate in Email Field 5

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

Validate the site-wide contact page form submission.

File

./email.module, line 285

Code

function email_mail_page_form_validate($form_id, $form_values) {
  if (!valid_email_address($form_values['mail'])) {
    form_set_error('mail', t('You must enter a valid e-mail address.'));
  }
  if (preg_match("/\r|\n/", $form_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_values['subject']), WATCHDOG_NOTICE);
  }
}