def pool_function(args): """ A wrapper for being able to launch all the threads. We will use python-emailahoy library for the verification in non-Windows systems as it is faster than validate_email. In Windows systems the latter is preferred. Args: ----- args: reception of the parameters for getPageWrapper as a tuple. Returns: -------- A dictionary representing whether the verification was ended successfully. The format is as follows: ``` {"platform": "str(domain["value"])", "status": "DONE", "data": aux} ``` """ is_valid = True try: if sys.platform == 'win32': is_valid = validate_email.validate_email(args, verify=True) else: is_valid = emailahoy.verify_email_address(args) except Exception, e: print( general.warning( "WARNING. An error was found when performing the search. You can omit this message.\n" + str(e))) is_valid = False
def test_function_based_valid_email(self): """ Test the existence of a valid email address (function based)""" email = '*****@*****.**' self.log.debug("Testing valid email address (%s)" % email) found = verify_email_address(email=email, from_host='neekware.com', from_email='*****@*****.**') # email exists self.assertEquals(found, True)
def send_email_dispatch(to, subject, message): if platform.platform().split('-')[0] == 'Linux': if verify_email_address(to): return send_email(to, subject, message) else: return { 'status': False, 'msg': '{} account don\'t exist'.format(to) } else: return send_email(to, subject, message)
def test_function_based_invalid_email(self): """ Test the existence of an invalid email address (function based)""" email = '*****@*****.**' self.log.debug("Testing invalid email address (%s)" % email) found = verify_email_address(email=email, from_host='neekware.com', from_email='*****@*****.**') # email doesn't exists self.assertEquals(found, False)
def test_function_based_valid_email(self): """ Test the existence of a valid email address (function based)""" email = '*****@*****.**' self.log.debug("Testing valid email address (%s)" % email) found = verify_email_address( email=email, from_host='neekware.com', from_email='*****@*****.**' ) # email exists self.assertEquals(found, True)
def test_function_based_invalid_email(self): """ Test the existence of an invalid email address (function based)""" email = '*****@*****.**' self.log.debug("Testing invalid email address (%s)" % email) found = verify_email_address( email=email, from_host='neekware.com', from_email='*****@*****.**' ) # email doesn't exists self.assertEquals(found, False)
def clean_email(self): """ Email should be unique """ email = self.cleaned_data.get('email', '').lower() if User.objects.filter(email__iexact=email): raise forms.ValidationError(_("This email address is already in use. Please supply a different email address.")) if defaults.AWEBER_VERIFY_IF_EMAIL_EXISTS: try: from emailahoy import verify_email_address except: raise ImproperlyConfigured('AWEBER_VERIFY_IF_EMAIL_EXISTS is set but python-emailahoy is not installed') if not verify_email_address(email): raise forms.ValidationError(_("Email address rejected. Please use a REAL and working email address.")) return email
def pool_function(args): '''Wrapper for being able to launch all the threads. We will use python-emailahoy library for the verification in non-Windows systems as it is faster than validate_email. In Windows systems the latter would be used. :param args: We receive the parameters for getPageWrapper as a tuple. ''' is_valid = True try: if sys.platform == 'win32': is_valid = validate_email.validate_email(args, verify=True) else: is_valid = emailahoy.verify_email_address(args) except Exception, e: print "WARNING. An error was found when performing the search. You can omit this message." print str(e) print is_valid = False
def performSearch(emails=[]): ''' Method to perform the mail verification process. :param emails: List of emails. :return: ''' results = [] for e in emails: if weCanCheckTheseDomains(e): if '_' not in e and "-" not in e: if emailahoy.verify_email_address(e): email, alias, domain = getMoreInfo(e) aux = {} aux["type"] = "i3visio.profile" aux["value"] = domain["value"]+ " - " +alias["value"] aux["attributes"]= [] aux["attributes"].append(email) aux["attributes"].append(alias) aux["attributes"].append(domain) results.append(aux) else: pass else: pass """ try: if not "gmail.com" in e and manualEmailCheck(e): aux = {} aux["type"] = "i3visio.email" aux["value"] = e aux["attributes"] = getMoreInfo(e) results.append(aux) except: # Probably a Timeout exception pass """ return results
def performSearch(emails=[]): ''' Method to perform the mail verification process. :param emails: List of emails. :return: ''' results = [] for e in emails: if weCanCheckTheseDomains(e): if '_' not in e and "-" not in e: if emailahoy.verify_email_address(e): email, alias, domain = getMoreInfo(e) aux = {} aux["type"] = "i3visio.profile" aux["value"] = domain["value"] + " - " + alias["value"] aux["attributes"] = [] aux["attributes"].append(email) aux["attributes"].append(alias) aux["attributes"].append(domain) results.append(aux) else: pass else: pass """ try: if not "gmail.com" in e and manualEmailCheck(e): aux = {} aux["type"] = "i3visio.email" aux["value"] = e aux["attributes"] = getMoreInfo(e) results.append(aux) except: # Probably a Timeout exception pass """ return results