function valid_email_address

Same name in other branches
  1. 8.9.x core/includes/common.inc \valid_email_address()

Verifies the syntax of the given e-mail address.

This uses the PHP e-mail validation filter. However, a module may override this by implementing hook_valid_email_address_alter(&$valid, $mail).

Parameters

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

Return value

TRUE if the address is in a valid format.

See also

hook_valid_email_address_alter()

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 1292

Code

function valid_email_address($mail) {
    $valid = (bool) filter_var($mail, FILTER_VALIDATE_EMAIL);
    drupal_alter('valid_email_address', $valid, $mail);
    return $valid;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.