Returns a Contact by it's email

        :param email: email to get contact for
        :return: Contact for specified email
        :rtype: Contact
17167
def get_contact_by_email(self, email):
        
        if not email:
            return None

        email = email.strip()
        query = self.q().any(collection='email_addresses', attribute='address',
                             word=email, operation='eq')
        contacts = self.get_contacts(limit=1, query=query)
        return contacts[0] if contacts else None
521956
def create_contact(self, email, name):
        
        params = {'email': email, 'name': name}

        url = self.CONTACTS_URL

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_header('Content-Type', 'application/json')
        connection.add_params(params, json_format=True)

        return connection.post_request()
218763
def create_contact(self, email=None, first_name=None, last_name=None, phone_number=None):
        
        result = {}
        if email:
            result['email'] = email
        if first_name is not None:
            result['first_name'] = first_name
        if last_name is not None:
            result['last_name'] = last_name
        if phone_number is not None:
            result['phone_number'] = phone_number
        return result if len(result) > 0 else None
196554
def get(self):
        
        email = {}
        if self.name is not None:
            email["name"] = self.name

        if self.email is not None:
            email["email"] = self.email
        return email
208054
def getContact(self, user=None, channel=None):
        
        try:
            return self.contacts[(channel, user)]
        except KeyError:
            new_contact = self.contactClass(self, user=user, channel=channel)
            self.contacts[(channel, user)] = new_contact
            new_contact.setServiceParent(self)
            return new_contact
491541
def get_contact(self, jid):
        
        try:
            return self.get_contacts()[jid.bare()]
        except KeyError:
            raise ContactNotFound
        except AttributeError:
            raise AttributeError("jid must be an aioxmpp.JID object")
221806
def email_from_name(self):
        
        lab_from_name = self.laboratory.getName()
        portal_from_name = self.portal.email_from_name
        return lab_from_name or portal_from_name
398656
def get(self):
        
        mail = {
            'from': self._get_or_none(self.from_email),
            'subject': self._get_or_none(self.subject),
            'personalizations': [p.get() for p in self.personalizations or []],
            'content': [c.get() for c in self.contents or []],
            'attachments': [a.get() for a in self.attachments or []],
            'template_id': self._get_or_none(self.template_id),
            'sections': self._flatten_dicts(self.sections),
            'headers': self._flatten_dicts(self.headers),
            'categories': [c.get() for c in self.categories or []],
            'custom_args': self._flatten_dicts(self.custom_args),
            'send_at':  self._get_or_none(self.send_at),
            'batch_id': self._get_or_none(self.batch_id),
            'asm': self._get_or_none(self.asm),
            'ip_pool_name': self._get_or_none(self.ip_pool_name),
            'mail_settings': self._get_or_none(self.mail_settings),
            'tracking_settings': self._get_or_none(self.tracking_settings),
            'reply_to': self._get_or_none(self.reply_to),
        }

        return {key: value for key, value in mail.items()
                if value is not None and value != [] and value != {}}
534576
def email_is_available(self, new_email):
        

        user, user_email = self.db_manager.get_user_and_user_email_by_email(new_email)
        return (user == None)
929484
def parse_contact(self):
        
        self.parse_whitespace()
        name = self.parse_name()  # parse a name expression and get the string.
        if not name:  # No name was found so shout it out.
            raise PartpyError(self, 'Expecting a name')

        self.parse_whitespace()
        # allow name and email to be delimited by either a ':' or '-'
        if not self.match_any_char(':-'):
            raise PartpyError(self, 'Expecting : or -')
        self.eat_length(1)
        self.parse_whitespace()

        email = self.parse_email()  # parse an email and store its string.
        if not email:
            raise PartpyError(self, 'Expecting an email address')
        return (name, email)
980027
def validate_email(self, value):
        
        if EMAIL_CONFIRMATION:
            queryset = EmailAddress.objects.filter(email__iexact=value, verified=True)
        else:
            queryset = User.objects.get(email__iexact=value, is_active=True).count() == 0
        if queryset.count() < 1:
            raise serializers.ValidationError(_("Email address not found"))
        return queryset.first().email
264292
def get_contact_by_email(self, email):
        
        if not email:
            return None

        email = email.strip()

        url = self.build_url('{}/{}'.format(self._endpoints.get('gal'), email))

        response = self.con.get(url)
        if not response:
            return []

        data = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        return self.contact_constructor(parent=self,
                                        **{self._cloud_data_key: data})
1267889
def get_applicant_from_email(email):
    
    try:
        applicant = Person.active.get(email=email)
        existing_person = True
    except Person.DoesNotExist:
        applicant = Applicant.objects.create(email=email)
        existing_person = False
    except Person.MultipleObjectsReturned:
        applicant = None
        existing_person = False
    return applicant, existing_person
1210322
def email_to(self):
        
        for field in self.form_fields:
            if field.is_a(fields.EMAIL):
                return self.cleaned_data[field.slug]
        return None
622292
def _existing(self, email):
        
        return self.store.findUnique(
            EmailAddress,
            EmailAddress.address == email,
            default=None)
312573
def import_contacts(self, email, password, include_name=False):
        
        data = {'email': email,
                'password': password}
        if include_name:
            data['names'] = 1
        return self.api_post('contacts', data)
228534
def email_verifier(self, email, raw=False):
        
        params = {'email': email, 'api_key': self.api_key}

        endpoint = self.base_endpoint.format('email-verifier')

        return self._query_hunter(endpoint, params, raw=raw)