Checking syntax of input email address

@param string $email Input string to evaluate
@return boolean Returns TRUE if the $email address (input string) is valid
184776
public static function validEmail($email) {
			// enforce maximum length to prevent libpcre recursion crash bug #52929 in PHP
			// fixed in PHP 5.3.4; length restriction per SMTP RFC 2821
		if (strlen($email) > 320) {
			return FALSE;
		}
		require_once(PATH_typo3 . 'contrib/idna/idna_convert.class.php');
		$IDN = new idna_convert(array('idn_version' => 2008));

		return (filter_var($IDN->encode($email), FILTER_VALIDATE_EMAIL) !== FALSE);
	}
1094665
def is_email(string):
    
    email_regex = r'^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$'

    if isinstance(string, str) and not re.match(email_regex, string):
        return False
    else:
        return True
938395
public static function email($email)
	{
		$atIndex = strrpos($email, '@');
		if (false === $atIndex)
		{
			return false;
		}
		else
		{
			$domain = substr($email, $atIndex + 1);
			$local = substr($email, 0, $atIndex);
			if (! strpos($domain, '.'))
			{
				return false;
			}
			else
			{
				$localLen = strlen($local);
				$domainLen = strlen($domain);
				if ($localLen < 1 || $localLen > 64)
				{
					// 本地部分长度超过
					return false;
				}
				else if ($domainLen < 1 || $domainLen > 255)
				{
					// 超出域部分长度
					return false;
				}
				else if ('.' === $local[0] || '.' === $local[$localLen - 1])
				{
					// 本地部分开始或结尾'.'
					return false;
				}
				else if (preg_match('/\\.\\./', $local))
				{
					// 本地部分已经连续两个点
					return false;
				}
				else if (! preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain))
				{
					// 字符不是有效的域部分
					return false;
				}
				else if (preg_match('/\\.\\./', $domain))
				{
					// 域部分已经连续两个点
					return false;
				}
				else if (! preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace('\\\\', '', $local)))
				{
					// 除非本地部分是引用字符不是有效的本地部分
					if (! preg_match('/^"(\\\\"|[^"])+"$/', str_replace('\\\\', '', $local)))
					{
						return false;
					}
				}
			}
		}
		return true;
	}
171451
def is_email_valid(email):
    
    pattern = re.compile(r'[\w\.-]+@[\w\.-]+[.]\w+')
    return bool(pattern.match(email))
1036810
private function validateEmail($email)
    {
        if (! filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw MakeUserException::invalidEmail($email);
        }

        if (app(config('auth.providers.users.model'))->where('email', $email)->exists()) {
            throw MakeUserException::emailExists($email);
        }
    }
452452
public static function checkMail(string $mail): bool
    {
        $securisedMail = Secure::secureData($mail, 'email', false);
        
        if ($securisedMail === false) {
            return false;
        }
        
        return true;
    }
583467
public final static boolean isValidEmail(String email) {
        if (email == null) {
            return false;
        } else {
            return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
        }
    }
933041
public function isEmailVerified($email) {
        try {
            $user = $this->api('/user/'.$email);
            if (isset($user['emails']) && is_array($user['emails']) && count($user['emails']) > 0) {
                foreach ($user['emails'] as $key => $value) {
                    if (isset($value['verified']) && $value['verified'] == true && $value['value'] == $email) {
                        return true;
                    }
                }
            }
        } catch (VGS_Client_Exception $e) {
            self::errorLog('Exception thrown when getting logged in user:'. $e->getMessage());
        }
        return false;
    }
33361
public function isEmailUnique($email)
    {
        if ($email) {
            try {
                $this->userRepository->findUserByEmail($email);
            } catch (NoResultException $exc) {
                return true;
            }
        }

        return false;
    }
818788
public function email($message = null)
    {
        $this->setRule(__FUNCTION__, function($email)
                       {
                           if (strlen($email) == 0) return true;
                           $isValid = true;
                           $atIndex = strrpos($email, '@');
                           if (is_bool($atIndex) && !$atIndex) {
                               $isValid = false;
                           } else {
                               $domain = substr($email, $atIndex+1);
                               $local = substr($email, 0, $atIndex);
                               $localLen = strlen($local);
                               $domainLen = strlen($domain);
                               if ($localLen < 1 || $localLen > 64) {
                                   $isValid = false;
                               }
                               else if ($domainLen < 1 || $domainLen > 255) {
                                   // domain part length exceeded
                                   $isValid = false;
                               }
                               else if ($local[0] == '.' || $local[$localLen-1] == '.') {
                                   // local part starts or ends with '.'
                                   $isValid = false;
                               }
                               else if (preg_match('/\\.\\./', $local)) {
                                   // local part has two consecutive dots
                                   $isValid = false;
                               }
                               else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
                                   // character not valid in domain part
                                   $isValid = false;
                               }
                               else if (preg_match('/\\.\\./', $domain)) {
                                   // domain part has two consecutive dots
                                   $isValid = false;
                               }
                               else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) {
                                   // character not valid in local part unless
                                   // local part is quoted
                                   if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) {
                                       $isValid = false;
                                   }
                               }
                               // check DNS
                               if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) {
                                   // hmm, the domain has no MX records
                                   if (checkdnsrr('gmail.com',"MX")) {
                                       // but Gmail does. the other domain must be dodgy
                                       $isValid = false;
                                   }
                                   // otherwise: probably running off-line or maybe DNS service is not working
                               }
                           }
                           return $isValid;
                       }, $message);
        return $this;
    }
792514
public function verifyEmail($email)
    {
        $path = 'users/verify_email';
        $request =  $this->_remoteServer->get($path);
        $request->getQuery()->set('email', $email);
        $response = $request->send();
        return $response->getBody('true');
    }
877627
protected function isCorrectEmailAddress($email,$title='') {
		if (is_array($email)) {
			$email = $email['address'];
		}
		
		if ($title == '') {
			$title = 'Email';
		}
		
		if (trim($email) == '') {
			throw new \Exception($title.' address can not be empty');
		}
		
		// email can be in breakets
		if (preg_match('!<.+>!',$email,$f)) {
			$email = $f[1];
		}
		
		// check against regular expression
		$regexp = '!^[_a-z0-9-+]+(\\.[_a-z0-9-+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$!i';
		
		if (strpos($email,',') > 0) {
			// can be list of meails
			$emails = explode(',',$email);
			
			foreach ($emails as $email) {
				if (trim($email) == '') {
					return false;
				}
				if (!preg_match($regexp, $email)) {
					throw new \Exception($title.' address has wrong format');
				}
			}
			return true;
		}
		
		if (!preg_match($regexp, $email)) {
			throw new \Exception($title.' address has wrong format');
		}
		return true;
	}
543169
protected function isEmailValid($email)
    {
        $constraint = new EmailConstraint();
        $result = $this->get('validator')->validate($email, $constraint);

        return 0 === count($result);
    }
356012
public function hasWallet($email)
    {
        $event = new CheckAvailability($email);
        $this->dispatcher->dispatch('before.availability.check', $event);
        $result = $this->hipay->isAvailable($email, $event->getEntity());
        $this->dispatcher->dispatch('after.availability.check', $event);
        return !$result;
    }
607295
public function setEmail($email)
    {
        $validator = new EmailValidator();
        if ($validator->validate($email)) {
            $this->_email = $email;
        } else {
            $this->_email = false;
        }
    }
285293
public function setSenderEmailAddress($email)
    {
        if (!$this->validateHeaderFieldValue($email)) {
            throw new EmailValidationException(__('Sender Email Address can not contain carriage return or newlines.'));
        }

        $this->_sender_email_address = $email;
    }
1260433
public function isEmailUnique($email)
    {
        $this->find("email", $email);
        if (isset($this->id)) {
            return false;
        }
        return true;
    }