GithubHelp home page GithubHelp logo

mossydidar / email-validator Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 5.0 1.14 MB

A piece of python code that checks E-mails for validity by sending requests to the respective mail servers and receiving those requests and outputting them in a terminal application.

Python 100.00%
python python3 emailverifier smtp-server proxy exception-handling

email-validator's Introduction

Email Validator

This repository contains all the information about how to check a bulk of E-mails for validity by sending requests to the respective mail servers and receiving those requests and outputting them in a terminal application.


Python Version: 3.6.7

Library Dependencies :

python dns.resolver
python smtplib
python socket
python re
python string
python random
python httplib or http.client

input: mail_address.txt (non-dynamic)

Input file consists of the list of emails that are to be tested.	

output: terminal


Abstract:

Module runs on the terminal successfully upon the file being invoked from the terminal, if all the python library dependencies are met. Checks each email from the 'mail_address.txt', gives the respective outputs in the terminal.

Domain exceptions: Microsoft Servers (Live, Hotmail, Outlook). Exceptions are handled

Core Software Requirements

The project primarily requires resources which can interact with mail services and their respective domains. Open Source programming languages such as Java and Python have numerous Libraries, functionalities and other similar resources that can be used to read and/or write to files or the console, manipulate strings and similar data types and data structures, match regular expressions, open and utilize sockets, get domain information on mailing services. We also require resources that can utilize some operations of the Simple Mail Transfer Protocol. Once all of the resources are accommodated, the project implementation can be initiated.

Physical Dependencies:

The physical dependencies or requirements include the availability of a functional Computer that has a favorable Operating System and an environment that can run programs of such nature. Additional physical Dependencies include an active internet connection.

Resourcing similar projects

For ease and reliability of our implementation, we also need to resource out similar projects or works done on email verification/validation on other languages or platforms, usually open-source. An example code (undeveloped) has been resourced from an open source blog from www.emailhippo.com.

Implementation

Programming Language used in the implementation of the project upon a majority of opinion was chosen to be Python (version 3.6.7). Python is a high-level, general purpose programming language, that provides numerous libraries among which a few of them are of great importance to this project.

Python DNS Resolver Library:

DNS Resolver is an API of Python that enables a program to collect resolved records about a specific domain. The domain of a e-mail address is parsed out of the string and then is used to retrieve the MX records of that specific domain.

Python Simple Mail Transfer Protocol Library:

Python smtplib is a module that allows the instantiation of a SMTP Client Session object that can be used to send or receive emails to any machine that has a SMTP listener daemon Here, the module is used to create an object ‘Server’ that does a ‘SMTP Conversation’, connecting and retrieving Mail Exchange (MX) records, matching and in turn receiving a code that implies whether an address is valid or not.

Python Socket Library:

The Socket module allows to instantiate a socket object, providing access to a socket interface. Here, the socket module is used to retrieve the host name required for the validation to take place.

Python Regular Expressions Library:

A python module that is used to match string and byte patterns; here the module is used match the given e-mail (input) to check if the address is a regular expression.

Python Random Library:

A python module that generates random characters and numbers. The random module is required to generate a random e-mail address that is sent SMTP object before receiving a validation code.

Python HTTP Client Library:

A module of python that allows to instantiate a HTTP or HTTPS Client side object. For this project, the module is only used to check if the internet connection is active or not prior to any kind of checking.

Source Code implementation -

The implementation of the whole project has been compiled to a single Python file. On run-time, the program takes inputs from another file (mail_address.txt) which contains the list of the e-mails to be validated. Upon being read and stored into a ‘List’, each e-mail is then checked through function calls recursively. After each successful check has been done, the results (val_response) are then printed on the console alongside each e-mail.

email-validator's People

Contributors

asifhaider995 avatar mossydidar avatar

Stargazers

 avatar  avatar

Watchers

 avatar

email-validator's Issues

Code Not Working

Following error occurs when I try to use your validator, Could you tell what is the problem?

c:\Users\ishaq\Desktop\\Email_Verification\email_validator.py:52: DeprecationWarning: please use dns.resolver.resolve() instead
  records = dns.resolver.query(domain[1], 'MX')
[email protected] ::: Internal Error
Traceback (most recent call last):
  File "c:\Users\ishaq\Desktop\Email_Verification\email_validator.py", line 72, in check
    server.helo(host)
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\smtplib.py", line 434, in helo
    (code, msg) = self.getreply()
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\smtplib.py", line 398, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "c:\Users\ishaq\Desktop\Email_Verification\email_validator.py", line 134, in 
    main()
  File "c:\Users\ishaq\Desktop\Email_Verification\email_validator.py", line 33, in main
    check(0, email_list)
  File "c:\Users\ishaq\Desktop\Email_Verification\email_validator.py", line 86, in check
    check_position(position, email_list)
  File "c:\Users\ishaq\Desktop\FiverWork\Email_Verification\email_validator.py", line 96, in check_position
    check(new_position, email_list)
  File "c:\Users\ishaq\Desktop\Email_Verification\email_validator.py", line 52, in check
    records = dns.resolver.query(domain[1], 'MX')
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\resolver.py", line 1321, in query
    return resolve(qname, rdtype, rdclass, tcp, source,
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\resolver.py", line 1305, in resolve
    return get_default_resolver().resolve(qname, rdtype, rdclass, tcp, source,
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\resolver.py", line 1202, in resolve
    (answer, done) = resolution.query_result(response, None)
  File "C:\Users\ishaq\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\resolver.py", line 674, in query_result
    raise NoAnswer(response=answer.response)
dns.resolver.NoAnswer: The DNS response does not contain an answer to the question: royaltybd.com. IN MX

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.