Try to fix invalid email addresses
347793
public static function fix_email($email)
    {
        $parts = rcube_utils::explode_quoted_string('@', $email);
        foreach ($parts as $idx => $part) {
            // remove redundant quoting (#1490040)
            if ($part[0] == '"' && preg_match('/^"([a-zA-Z0-9._+=-]+)"$/', $part, $m)) {
                $parts[$idx] = $m[1];
            }
        }

        return implode('@', $parts);
    }
969764
def clean_email(self):
        
        if EMAIL_CONFIRMATION:
            from .models import EmailAddress
            condition = EmailAddress.objects.filter(
                email__iexact=self.cleaned_data["email"],
                verified=True
            ).count() == 0
        else:
            condition = User.objects.get(
                email__iexact=self.cleaned_data["email"],
                is_active=True
            ).count() == 0

        if condition is True:
            raise forms.ValidationError(
                _("Email address not verified for any user account")
            )
        return self.cleaned_data["email"]
531594
function(apiKey, contactList, fromAddress,
        toAddress, ccAddresses, bccAddresses, contentType, subject, htmlBody,
        textBody, _templateId) {}
109749
def change_email(*_, user_id=None, new_email=None):
    
    click.echo(green('\nChange email:'))
    click.echo(green('-' * 40))

    with get_app().app_context():
        user = find_user(dict(id=user_id))
        if not user:
            click.echo(red('User not found\n'))
            return

        user.email = new_email
        result = user_service.save(user)
        if not isinstance(result, User):
            print_validation_errors(result)
            return

        user.confirm_email()
        user_service.save(user)
        msg = 'Change email for user {} to {} \n'
        click.echo(green(msg.format(user.email, new_email)))
1192998
function getEmailIfValid(emailToVerify) {
  if (emailToVerify) {
    const email = emailToVerify.trim();
    if (emailRegex.test(email)) {
      return email;
    } else {
      return undefined;
    }
  }
}
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
1021982
def SplitEmailsAndAppendEmailDomain(self, address_list):
    """"""
    result = []
    # Process email addresses, and build up a list.
    if isinstance(address_list, rdf_standard.DomainEmailAddress):
      address_list = [str(address_list)]
    elif isinstance(address_list, string_types):
      address_list = [address for address in address_list.split(",") if address]
    for address in address_list:
      result.append(self.AddEmailDomain(address))
    return result
828551
def clean_email(self):
        
        try:
            accounts = APPLICATION.accounts.search({'email': self.cleaned_data['email']})
            if len(accounts):
                msg = 'User with that email already exists.'
                raise forms.ValidationError(msg)
        except Error as e:
            raise forms.ValidationError(str(e))

        return self.cleaned_data['email']
511737
def form_invalid(self, form):
        """"""
        ip = get_user_ip(self.request)
        if settings.CONTACT_FORM_USE_SIGNALS:
            contact_form_invalid.send(
                sender=self,
                event=self.invalid_event,
                ip=ip,
                site=self.site,
                sender_name=form['sender_name'],
                sender_email=form['sender_email']
            )

        return super(ContactFormView, self).form_invalid(form)
454588
function emailCheck(email, key) {
  email = email.toLowerCase();
  // escape email before using in regular expression
  const emailEsc = email.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  const emailRegex = new RegExp('<' + emailEsc + '>');
  const userIds = key.getUserIds();
  for (let i = 0; i < userIds.length; i++) {
    const userId = userIds[i].toLowerCase();
    if (email === userId || emailRegex.test(userId)) {
      return true;
    }
  }
  return false;
}
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;
	}
474071
def is_valid_email(email):
    
    pattern = re.compile(r'[\w\.-]+@[\w\.-]+[.]\w+')
    return bool(pattern.match(email))
21938
def weCanCheckTheseDomains(email):
    
    # Known platform not to be working...
    notWorking = [
        "@aol.com",
        "@bk.ru",
        "@breakthru.com",
        "@gmx.",
        "@hotmail.co",
        "@inbox.com",
        "@latinmail.com",
        "@libero.it",
        "@mail.ru",
        "@mail2tor.com",
        "@outlook.com",
        "@rambler.ru",
        "@rocketmail.com",
        "@starmedia.com",
        "@ukr.net"
        "@yahoo.",
        "@ymail."
    ]

    #notWorking = []
    for n in notWorking:
        if n in email:
            print("\t[*] Verification of '{}' aborted. Details:\n\t\t{}".format(general.warning(email), "This domain CANNOT be verified using mailfy."))
            return False

    emailDomains = EMAIL_DOMAINS
    safe = False

    for e in EMAIL_DOMAINS:
        if e in email:
            safe =  True

    if not safe:
        print("\t[*] Verification of '{}' aborted. Details:\n\t\t{}".format(general.warning(email), "This domain CANNOT be verified using mailfy."))
        return False
    return True
1361725
def validate_new_email(email):
    """"""
    email = normalize_email(email)
    User = get_user_model()  # noqa
    if User.objects.filter(email=email).exists():
        raise ValidationError('The given email address is already registered.')
433556
def check_address(self, address):
        """"""
        if address is None:
            self.raise_error(InvalidAddress, details='address is None')
        if all(letter == address[0] for letter in address) or len(address) < self.minFundingAddressLength or ' ' in address:
            self.raise_error(InvalidAddress, details='address is invalid or has less than ' + str(self.minFundingAddressLength) + ' characters: "' + str(address) + '"')
        return address
407085
function (form) {
            var data = {
              email: form.data.email
            };

            if (req.organization) {
              data.accountStore = {
                href: req.organization.href
              };
            }

            application.sendPasswordResetEmail(data, function (err) {
              if (err) {
                logger.info('A user tried to reset their password, but supplied an invalid email address: ' + form.data.email + '.');
              }

              res.redirect(config.web.forgotPassword.nextUri);
            });
          }
512417
def list_invalid_properties
      invalid_properties = Array.new
      if !@display_name.nil? && @display_name.to_s.length > 255
        invalid_properties.push("invalid value for 'display_name', the character length must be smaller than or equal to 255.")
      end

      if !@email_address.nil? && @email_address.to_s.length > 255
        invalid_properties.push("invalid value for 'email_address', the character length must be smaller than or equal to 255.")
      end

      if !@phone_number.nil? && @phone_number.to_s.length > 16
        invalid_properties.push("invalid value for 'phone_number', the character length must be smaller than or equal to 16.")
      end

      return invalid_properties
    end