def test_returns_email_info_data(self):
        from emailverifier import Client

        client = Client(environ.get('API_KEY'))

        self.assertEqual(
            client.get('*****@*****.**').email_address,
            '*****@*****.**')
    def init_app(self, app):
        api_key = app.config.get(CONFIG_KEY) or environ.get(CONFIG_KEY)
        if not api_key:
            raise Exception(
                """No API key was supplied for performing email verification. 
            Please set a value for EMAIL_VERIFIER_KEY.""")

        self.client = Client(api_key)
Exemplo n.º 3
0
def validateEmail(email):
    print("i am email")
    if len(email) == 10 and email.isdigit():
        print("phone")
        return validatePhone(email)
    else:
        client = Client('at_mMeTEJCIsEHnsAhHHp93G5JCG2aLR')
        data = ''
        try:
            data = client.get(email)
        except exceptions.HttpException:
            # If you get here, it means service returned HTTP error code
            pass
        except exceptions.GeneralException:
            # If you get here, it means you cannot connect to the service
            pass
        except exceptions.UndefinedVariableException:
            # If you get here, it means you forgot to specify the API key
            pass
        except exceptions.InvalidArgumentException:
            # If you get here, it means you specified invalid argument
            # (options should be a dictionary)
            pass
        except:
            pass
        if data != '':
            # print("Email address: " + data.email_address)
            # print("Format: " + str(data.format_check))
            # print("DNS: " + str(data.dns_check))
            # print("SMTP: " + str(data.smtp_check))
            # print("Catch all: " + str(data.catch_all_check))
            # print("Disposable: " + str(data.disposable_check))
            # print("Free: " + str(data.free_check))
            # print("Last audit date: " + str(data.audit.audit_updated_date))

            User.objects.filter(email=email).exclude(last_name="0000").delete()
            row = User.objects.filter(email=email, last_name="0000")
            if not row.exists():
                verification_code = str(random.randint(1, 9999))
                send_mail(
                    'Verification',
                    'Please verify your account with this code' +
                    verification_code,
                    '*****@*****.**',
                    [email],
                    fail_silently=False,
                )
                return verification_code
            else:
                return "*email already exists !!"
        else:
            return "*email is not valid"
    def test_raises_http_error_on_error(self):
        from emailverifier import Client
        from emailverifier.exceptions import HttpException

        client = Client('')

        self.assertRaises(HttpException, client.get, '[email protected]')
    def test_raises_general_exception_on_connection_error_get_raw(self):
        from emailverifier import Client
        from emailverifier.exceptions import GeneralException

        client = Client('', 'https://api.asdgasggasgdasgdsasgdasdfadfsda.com')

        self.assertRaises(GeneralException, client.get_raw, '[email protected]')
Exemplo n.º 6
0
def checkEmail(emailAddr):
    client = Client('you gotta be crapping me')
    try:
        data = client.get(emailAddr)
        # print("Email address: " + data.email_address)
        # print("Format: " + str(data.format_check))
        # print("DNS: " + str(data.dns_check))
        # print("SMTP: " + str(data.smtp_check))
        # print("Catch all: " + str(data.catch_all_check))
        # print("Disposable: " + str(data.disposable_check))
        # print("Free: " + str(data.free_check))
        # print("Last audit date: " + str(data.audit.audit_updated_date))
        if (data.dns_check and data.smtp_check):
            return True
        else:
            return False
    except:
        print("Something crappy happened. Not sure what.")
class EmailVerifier(object):
    def __init__(self, app=None):
        self.app = app
        if app is not None:
            self.init_app(app)

    def init_app(self, app):
        api_key = app.config.get(CONFIG_KEY) or environ.get(CONFIG_KEY)
        if not api_key:
            raise Exception(
                """No API key was supplied for performing email verification. 
            Please set a value for EMAIL_VERIFIER_KEY.""")

        self.client = Client(api_key)

    def verify(self, email, options=None):
        try:
            data = self.client.get(email, options)
        except ApiBaseException:
            data = None

        return data
Exemplo n.º 8
0
# Third-party modules 
from emailverifier import Client
from emailverifier import exceptions
import simplejson as json
# Built-in modules 
from distutils.util import strtobool    # module for converting strings to boolean 
import os


# Config email verifier
verifier = Client(str(os.environ.get('EMAIL_VERIFIER')))


def emailVerifier(email):
    """Retrieves information from the API about the given email address
    
    Arguments:
        email {[str]} -- email address
    
    Returns:
        {[dict]} -- response message and status code
    """
    # Try and Except Block
    try:
        f = verifier.get(email, {'validateSMTP': 0, '_hardRefresh': 1})  # Verify email using api from whoisxmlapi.com

        # Convert JSON to PYTHON object
        convert = json.dumps(json.loads(f.json_string), indent=4)
        data = json.loads(convert)

        # Make checks to verify if email is good to be accepted or not.
Exemplo n.º 9
0
		mail.send(msg)


htmlbody='''
Your account on <b>The Best</b> Quiz App was successfully created.
Please click the link below to confirm your email address and
activate your account:
  
<a href="{{ confirm_url }}">{{ confirm_url }}</a>
 <p>
--
Questions? Comments? Email </p>
'''

#email verifier api key
client = Client('at_rFxZz7zEX8CO8V5IDBfzexOe2fW8b')



def get_local_ip():	
	s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	s.connect(('8.8.8.8', 1))
	local_ip_address = s.getsockname()[0]
	return local_ip_address


def send_email(recipients,html_body):
	try:
		msg = Message('Confirm Your Email Address',
		  sender="*****@*****.**",
		  recipients=recipients)
Exemplo n.º 10
0
#Type this in your command prompt if you dont have these installed 


from emailverifier import Client		#pip install email-verifier
from emailverifier import exceptions
import re    							#pip install regex 

client = Client('at_1bTGUCnOaIIaxviZfTVSSFhCEJWd6')

#Regular Experessions
gmail_reg = '^[a-z0-9](\.?[a-z0-9]){5,30}@g(oogle)?mail\.com$'
hotmail_reg = '^[a-zA-Z0-9-_\.+]{5,}@(live|hotmail)(\.[a-z]{2,3}){1,2}'

#You can add the required domains yourself
doms = ['@gmail.com']

#Temporary Class to facilitate better handling 
class data:
	smtp_check = 'False'


#Enter the name of the file the mail should be stored in
writeToFile = open("AvailableEmail.txt", "w")
            
with open("Names.txt", "r") as NamesFile:
	for name in NamesFile:
		name = name.rstrip()
		for domain in doms:
  
			mail = name + domain
Exemplo n.º 11
0
# Third-party modules
from emailverifier import Client
from emailverifier import exceptions
import simplejson as json
# Built-in modules
from distutils.util import strtobool  # module for converting strings to boolean

# Config email verifier
verifier = Client("api_key")


def emailVerifier(email):
    """Retrieves information from the API about the given email address
    
    Arguments:
        email {[str]} -- email address
    
    Returns:
        resp {[dict]} -- response message and status code
    """
    # Try and Except Block
    try:
        f = verifier.get(email, {
            'validateSMTP': 0,
            '_hardRefresh': 1
        })  # Verify email using api from whoisxmlapi.com

        # Convert JSON to PYTHON object
        convert = json.dumps(json.loads(f.json_string), indent=4)
        data = json.loads(convert)