/*
@desc: Return a valid email
@return: String
@params: none
768598
function (name, lastname) {
		name = name || this.exports.generate.name();
		lastname = lastname || this.exports.generate.lastName();
		var ret = name + '.' + lastname + '@' + this.exports.generate.domain();
		return ret.replace(/ /g, '').toLowerCase();
	}
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
750476
def get(self, request, key):
        """"""

        try:
            email_val = EmailAddressValidation.objects.get(validation_key=key)
        except EmailAddressValidation.DoesNotExist:
            messages.error(request, _('The email address you are trying to '
                                      'verify either has already been verified'
                                      ' or does not exist.'))
            return redirect('/')

        try:
            email = EmailAddress.objects.get(address=email_val.address)
        except EmailAddress.DoesNotExist:
            email = EmailAddress(address=email_val.address)

        if email.user and email.user.is_active:
            messages.error(request, _('The email address you are trying to '
                                      'verify is already an active email '
                                      'address.'))
            email_val.delete()
            return redirect('/')

        email.user = email_val.user
        email.save()
        email_val.delete()

        user = User.objects.get(username=email.user.username)
        user.is_active = True
        user.save()

        messages.success(request, _('Email address verified!'))
        return redirect('user_profile', username=email_val.user.username)
902291
def get_email_link(email, value=None):
    
    if not email:
        return ""
    mailto = 'mailto:{}'.format(email)
    link_value = value and value or email
    return get_link(mailto, link_value)
1325056
function getSubscriberByEmail(options) {
            if (options.email) {
                return models.Subscriber.getByEmail(options.email, options)
                    .then((subscriber) => {
                        if (!subscriber) {
                            return Promise.reject(new common.errors.NotFoundError({
                                message: common.i18n.t('errors.api.subscribers.subscriberNotFound')
                            }));
                        }

                        options.id = subscriber.get('id');
                        return options;
                    });
            }

            return options;
        }
354682
public static function email($email)
    {
        $email = Str::trim($email);
        $cleaned = filter_var($email, FILTER_VALIDATE_EMAIL);

        if (Email::isValid($cleaned)) {
            return $cleaned;
        }

        return false;
    }
394191
public static boolean isEmail(String s) {
        if (isEmpty(s)) return defaultEmptyOK;

        // is s whitespace?
        if (isWhitespace(s)) return false;

        // there must be >= 1 character before @, so we
        // start looking at character position 1
        // (i.e. second character)
        int i = 1;
        int sLength = s.length();

        // look for @
        while ((i < sLength) && (s.charAt(i) != '@')) i++;

        // there must be at least one character after the .
        if ((i >= sLength - 1) || (s.charAt(i) != '@'))
            return false;
        else
            return true;

        // DEJ 2001-10-13 Don't look for '.', some valid emails do not have a dot in the domain name
        // else i += 2;

        // look for .
        // while((i < sLength) && (s.charAt(i) != '.')) i++;
        // there must be at least one character after the .
        // if((i >= sLength - 1) || (s.charAt(i) != '.')) return false;
        // else return true;
    }
210558
def is_valid_email(self):
        
        return bool(self.address and Email.re_email.match(self.address))
1335395
def CheckEmail(self, email, checkTypo=False):
        ''''''
        contents = email.split('@')
        if len(contents) == 2:
            if contents[1] in self.valid:
                return True
        return False
205289
def email_addresses2marc(self, key, value):
    
    m_or_o = 'm' if value.get('current') else 'o'
    element = {
        m_or_o: value.get('value')
    }

    if value.get('hidden'):
        return element
    else:
        self.setdefault('371', []).append(element)
        return None
476760
private String getEmail(Server server) {
        Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
        if (configuration != null) {
            Xpp3Dom emailNode = configuration.getChild("email");
            if (emailNode != null) {
                return emailNode.getValue();
            }
        }
        return null;
    }
621742
def validate_email_with_name(value):
    
    value = force_text(value)

    recipient = value
    if '<' and '>' in value:
        start = value.find('<') + 1
        end = value.find('>')
        if start < end:
            recipient = value[start:end]

    validate_email(recipient)
1175317
@Override
	public String getEmail() {
		StringBuilder sb = new StringBuilder();

		sb.append(getFirstName().toLowerCase());
		sb.append(".");
		sb.append(getLastName().toLowerCase());
		sb.append("@example.com");

		return sb.toString().replace(' ', '.');
	}
809210
def clean_email(self):
        
        email = self.cleaned_data.get("email")
        qs = User.objects.exclude(id=self.instance.id).filter(email=email)
        if len(qs) == 0:
            return email
        raise forms.ValidationError(
                                ugettext("This email is already registered"))
777289
function(){
			var payload = { recipients: {} },
				invalid = [],
				promise = new Promise();
			for(var i=0, j=this.mails.length; i < j; i++){
				var data = this.mails[i],
					email = data.email;

					if(!data.template_id){
						invalid.push(data)
						data.error = "No template provided"
						continue;
					}

					if(typeof data.email === 'undefined'){
						invalid.push(data)
						data.error = "No email provided"
						continue;
					}


				delete data['email'];

				payload.recipients[email] = data
			}
			if(invalid.length > 0){
				promise.reject('invalid', invalid);
			}else{
				apostle.send(payload, promise);
			}
			return promise;
		}
1370657
def valid_email?(email)
      mail = Mail::Address.new(email)

      # We must check that value contains a domain and that value is 
      # an email address
      result = mail.domain && mail.address == email
      tree = mail.__send__(:tree)

      # We need to dig into treetop. A valid domain must have 
      # dot_atom_text elements size > 1. Addresses like user@localhost 
      # are excluded. Treetop must respond to domain.
      result && (tree.domain.dot_atom_text.elements.size > 1)
    rescue => e
      false
    end
49049
function (user) {
  if (user.id)
    return {_id: user.id};
  else if (user.username)
    return {username: user.username};
  else if (user.email)
    return {"emails.address": user.email};
  throw new Error("shouldn't happen (validation missed something)");
}