This method returns the access level coupled with the domain of the given email
If the given domain name has not been configured this function will return null

@param string $email

@return string[]|null
516017
private function getAccessLevels($email)
    {
        foreach ($this->hostedDomains as $hostedDomain) {
            if (preg_match('/'.$hostedDomain['domain_name'].'$/', $email)) {
                return $hostedDomain['access_levels'];
            }
        }

        return null;
    }
826951
public function isAdmin(?string $email = null): bool
    {
        if ($email === null) {
            return false;
        }
        return in_array($email, $this->getConfig()['admin']);
    }
346233
public function emailStatByCampaigns($email)
    {
        if (empty($email)) {
            return $this->handleError('Empty email');
        }

        $requestResult = $this->sendRequest('emails/' . $email . '/campaigns');

        return $this->handleResult($requestResult);
    }
99268
public function getCustomerByEmail(string $email) : array
    {
        Assert::that($email)->email();

        return (array)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerByEmail?email=%s', rawurlencode($email))
        );
    }
460776
protected function getByEmail($email) {
        $users = $this->_client->get('/users?search='.urlencode($email));
        return isset($users[0]) ? $users[0] : false;
    }
484482
static function fetchByEmail( $email )
    {
        $cond = array( 'email' => $email );
        $return = eZPersistentObject::fetchObject( self::definition(), null, $cond );
        return $return;
    }
404854
protected function normalizeEmail($email)
    {
        if (is_array($email)) {

            $emails = [];

            foreach ($email as $k => $v) {
                if (is_int($k)) {
                    $emails[$k] = $this->getManager()->normalizeEmail($v);
                } else {
                    $k = $this->getManager()->normalizeEmail($k);
                    $emails[$k] = $v;
                }
            }

            return $emails;

        } else {
            return $this->getManager()->normalizeEmail($email);
        }
    }
674176
public static String getEmailDomain(final String email) {
    if (email == null || email.isEmpty()) {
      return null;
    }

    final int atSignIndex = email.indexOf('@');
    if (atSignIndex != -1) {
      return email.substring(atSignIndex + 1);
    }

    return null;
  }
750807
public static function hideEmail($mail) {
		$mailParts = explode('@', $mail, 2);
		$domainParts = explode('.', $mailParts[1], 2);

		$user = mb_substr($mailParts[0], 0, 1) . '..' . mb_substr($mailParts[0], -1, 1);
		$domain = mb_substr($domainParts[0], 0, 1) . '..' . mb_substr($domainParts[0], -1, 1) . '.' . $domainParts[1];
		return $user . '@' . $domain;
	}
1150231
public function findByEmail($email)
    {
        $qb = $this->createQueryBuilder('u');

        $qb->where($qb->expr()->eq($qb->expr()->lower('u.email'), $qb->expr()->lower($qb->expr()->literal($email))))
            ->andWhere($qb->expr()->isNotNull('u.email'))
            ->andWhere($qb->expr()->eq('u.deleted', $qb->expr()->literal(false)));

        return $qb->getQuery()->getOneOrNullResult();
    }
1240637
public static function isEmail($email = null)
    {
        if (is_null($email) || !$email || !is_string($email)) {
            return false;
        }
        return (bool) (preg_match('/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/', $email) > 0);
    }
1203524
public function isTrustedEmail($email)
    {
        static $trustedEmails = [
            '@gmail.com'    => 'Google',
            '@yandex.ru'    => 'Yandex',
        ];
        foreach ($trustedEmails as $domain => $trusted) {
            if ($this->provider === static::toProvider($trusted) && substr($email, -strlen($domain)) === $domain) {
                return true;
            }
        }

        return false;
    }
1278396
public function is_valid_login_domain($email) {
        if (empty($this->get('alloweddomains'))) {
            return true;
        }

        $validdomains = explode(',', $this->get('alloweddomains'));

        $parts = explode('@', $email, 2);
        $emaildomain = '';
        if (count($parts) > 1) {
            $emaildomain = $parts[1];
        }

        return \core\ip_utils::is_domain_in_allowed_list($emaildomain, $validdomains);
    }
1111998
protected static function validateEmailAddress($email) {
		if (empty($email)) {
			throw new InvalidEmailException();
		}

		$email = \trim($email);

		if (!\filter_var($email, \FILTER_VALIDATE_EMAIL)) {
			throw new InvalidEmailException();
		}

		return $email;
	}
1067862
static function email2user($email)
    {
        $rcube = rcube::get_instance();
        $plugin = $rcube->plugins->exec_hook('email2user',
            array('email' => $email, 'user' => NULL));

        return $plugin['user'];
    }
883493
protected function checkValidEmail($email) {
    if (function_exists('mailparse_rfc822_parse_addresses')) {
      $parsed = mailparse_rfc822_parse_addresses($email);
      if (count($parsed) > 0 && array_key_exists('address', $parsed[0])) {
        $email = $parsed[0]['address'];
      } else {
        return false;
      }
    }
    return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
  }
613031
static public function getSecondDomain($domain=null)
	{
	    $domain = !empty($domain) ? $domain : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
	    $n = preg_match('/([^.]*\.)?([^.]*\.)?\w+\.\w+$/', $domain, $matches);
	    return $domain && isset($matches[2]) ? $matches[2] : (isset($matches[1]) ? $matches[1] : '');
	}