user_validate_mail

function user_validate_mail

user_validate_mail($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.

File

modules/user/user.module, line 675
Enables the user registration and login system.

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));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.module/function/user_validate_mail/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部