function user_validate_mail

Validates a user's email address.

Checks that a user's email address exists and follows all standard validation rules. Returns error messages when the address is invalid.

Parameters

$mail: A user's email address.

Return value

If the address is invalid, a human-readable error message is returned. If the address is valid, nothing is returned.

5 calls to user_validate_mail()
install_configure_form_validate in includes/install.core.inc
Form validation handler for install_configure_form().
system_site_information_settings_validate in modules/system/system.admin.inc
Validates the submitted site-information form.
UserValidationTestCase::testAlteredMailValidation in modules/user/user.test
UserValidationTestCase::testMailAddresses in modules/user/user.test
user_account_form_validate in modules/user/user.module
Form validation handler for user_account_form().

File

modules/user/user.module, line 677

Code

function user_validate_mail($mail) {
    if (!$mail) {
        return t('You must enter an e-mail address.');
    }
    if (!valid_email_address($mail)) {
        return t('The e-mail address %mail is not valid.', array(
            '%mail' => $mail,
        ));
    }
}

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