valid_email_address

valid_email_address($mail)

Verifies the syntax of the given email address.

Parameters

string $mail: A string containing an email address.

Return value

bool TRUE if the address is in a valid format.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal::service('email.validator')->isValid().

Related topics

Input validation
Functions to validate user input.

File

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

Code

function valid_email_address($mail) {
  return \Drupal::service('email.validator')->isValid($mail);
}
doc_Drupal
2016-10-29 09:53:24
Comments
Leave a Comment

Please login to continue.