Check if email is valid
171451
def is_email_valid(email):
    
    pattern = re.compile(r'[\w\.-]+@[\w\.-]+[.]\w+')
    return bool(pattern.match(email))
184531
def valid_email(x: str) -> bool:
    
    if isinstance(x, str) and re.match(EMAIL_PATTERN, x):
        return True
    else:
        return False
720463
private function hasEmail()
    {
        $email = $this->_scopeConfig->getValue('payment/pagseguro/email');

        // check for a e-mail
        if (!isset($email))
            return false;

        // check is the e-mail is valid
        if ($this->isValidEmail($email))
            return true;
        return false;
    }
1215599
def validate_comma_separated_emails(value):
    
    if not isinstance(value, (tuple, list)):
        raise ValidationError('Email list must be a list/tuple.')

    for email in value:
        try:
            validate_email_with_name(email)
        except ValidationError:
            raise ValidationError('Invalid email: %s' % email, code='invalid')
703700
public function isAccountValid($email)
    {
        $response = $this->rest->post(
            static::ACCOUNT_VALIDATE_PATH,
            array(
                'email_address' => $email
            )
        );

        $this->checkResponse($response);

        return property_exists($response, 'account');
    }
628144
def is_email_simple(value):
        """"""
        # An @ must be in the middle of the value.
        if '@' not in value or value.startswith('@') or value.endswith('@'):
            return False
        try:
            p1, p2 = value.split('@')
        except ValueError:
            # value contains more than one @.
            return False
        # Dot must be in p2 (e.g. example.com)
        if '.' not in p2 or p2.startswith('.'):
            return False
        return True
1335395
def CheckEmail(self, email, checkTypo=False):
        ''''''
        contents = email.split('@')
        if len(contents) == 2:
            if contents[1] in self.valid:
                return True
        return False
725616
def form_valid(self, form):
        '''  '''
        form.cleaned_data.pop('template', None)
        self.request.session[EMAIL_VALIDATION_STR] = {'form_data': form.cleaned_data}
        return HttpResponseRedirect(reverse('emailConfirmation'))
264867
public function checkEmail() {
    if ($this->email === '') {
      return ['result' => true, 'message' => ''];
    }
    if (empty($this->email)) {
      return ['result' => false, 'message' => 'Please specify a valid email.'];
    }
    if (!preg_match(
        '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',
        $this->email
    )) {
      return [
        'result' => false,
        'message' => 'Email must be a correctly formatted address.'
      ];
    }
    $selector = ['&',
      'ilike' => [
        'email',
        str_replace(['\\', '%', '_'], ['\\\\\\\\', '\%', '\_'], $this->email)
      ]
    ];
    if (isset($this->guid)) {
      $selector['!guid'] = $this->guid;
    }
    $test = Nymph::getEntity(
        ['class' => '\Tilmeld\Entities\Group', 'skip_ac' => true],
        $selector
    );
    if (isset($test->guid)) {
      return [
        'result' => false,
        'message' => 'That email address is already registered.'
      ];
    }

    return [
      'result' => true,
      'message' => (
        isset($this->guid) ? 'Email is valid.' : 'Email address is valid!'
      )
    ];
  }
474071
def is_valid_email(email):
    
    pattern = re.compile(r'[\w\.-]+@[\w\.-]+[.]\w+')
    return bool(pattern.match(email))
1198614
public function _validation_valid_emails($val, $separator = ',')
	{
		if ($this->_empty($val))
		{
			return true;
		}

		$emails = explode($separator, $val);

		foreach ($emails as $e)
		{
			if ( ! filter_var(trim($e), FILTER_VALIDATE_EMAIL))
			{
				return false;
			}
		}
		return true;
	}
437083
def validate_email(self, email_address):

        '''
            
        '''

        title = '%s.validate_email' % __class__.__name__

    # validate inputs
        object_title = '%s(email_address="")' % title
        email_address = self.fields.validate(email_address, '.email_address', object_title)

    # construct request_kwargs
        request_kwargs = {
            'url': '%s/address/validate' % self.api_endpoint,
            'params': { 'address': email_address }
        }

    # send request
        response_details = self._get_request(**request_kwargs)

        return response_details
951730
def confirm_email(self, request, email_address):
        
        email_address.verified = True
        email_address.set_as_primary(conditional=True)
        email_address.save()
1010020
def is_email_address(string):
    
    return string and isinstance(string, base_string) \
        and REGEX_PATTERN_EMAIL_ADDRESS.match(string.strip().lower())
1197951
def validate(self, value):
        ""

        # Use the parent's handling of required fields, etc.
        super(MultiEmailField, self).validate(value)
        try:
            for email in value:
                validate_email(email)
        except ValidationError:
            raise ValidationError(self.message, code=self.code)
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;
  }
1334347
def verify_email_for_object(self, email, content_object, email_field_name='email'):
        

        confirmation_key = generate_random_token()

        try:
            confirmation = EmailConfirmation()
            confirmation.content_object = content_object
            confirmation.email_field_name = email_field_name
            confirmation.email = email
            confirmation.confirmation_key = confirmation_key
            confirmation.save()
        except IntegrityError:
            confirmation = EmailConfirmation.objects.get_for_object(content_object, email_field_name)
            confirmation.email = email
            confirmation.confirmation_key = confirmation_key
            confirmation.save(update_fields=['email', 'confirmation_key'])

        confirmation.send()

        return confirmation