You are here

function valid_email_address in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/common.inc \valid_email_address()
  2. 4 includes/common.inc \valid_email_address()
  3. 5 includes/common.inc \valid_email_address()
  4. 6 includes/common.inc \valid_email_address()

Verifies the syntax of the given e-mail address.

This uses the PHP e-mail validation filter.

Parameters

$mail: A string containing an e-mail address.

Return value

TRUE if the address is in a valid format.

Related topics

8 calls to valid_email_address()
comment_form_validate in modules/comment/comment.module
Validate comment form submissions.
contact_category_edit_form_validate in modules/contact/contact.admin.inc
Form validation handler for contact_category_edit_form().
contact_personal_form_validate in modules/contact/contact.pages.inc
Form validation handler for contact_personal_form().
contact_site_form_validate in modules/contact/contact.pages.inc
Form validation handler for contact_site_form().
system_send_email_action_validate in modules/system/system.module
Validate system_send_email_action form submissions.

... See full list

File

includes/common.inc, line 1250
Common functions that many Drupal modules will need to reference.

Code

function valid_email_address($mail) {
  return (bool) filter_var($mail, FILTER_VALIDATE_EMAIL);
}