You are here

public function User::getEmail in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/Entity/User.php \Drupal\user\Entity\User::getEmail()

Returns the email address of this account.

Return value

string|null The email address, or NULL if the account is anonymous or the user does not have an email address.

Overrides AccountInterface::getEmail

File

core/modules/user/src/Entity/User.php, line 237

Class

User
Defines the user entity class.

Namespace

Drupal\user\Entity

Code

public function getEmail() {
  return $this
    ->get('mail')->value;
}