Monday, December 5, 2011

Python script to check valid email addresses

We were having discussion about checking a list of email addresses for validity.
one of member had posted a bash script for Linux to verify the email addresses before sending the emails.

I thought to write a python script for the same in windows. Well this script can be easily ported to linux with just one or two lines changed. But I was too tired after all day office work to write check for OS and write windows as well as linux code. Currently it is only for gmail domain. But can be easily ported to every domain. Just need to extract domain from email id and check its MX by the existing code. (I told you already I am tired to write more code)
If some people found this useful and need sophisticated version then I would release a next version of program.

This python code take one argument which is list of emails one per line in text format.

You can download python file HERE

5 comments:

VIVL OLO said...

please put it on github

neo said...

Put it on Github, done.

https://github.com/neo198one/valid-email-py/blob/master/chkEmail.py

Albert Saini said...

hey neo,
can u plz tell me how this is work...i mean to say how you write this software ...in a paragraph what it exactly do.
does it verify email in a particular domain like u given 'gmail.com'....means it checks the all email in gmail domian ...plz explain me..am a student..

neo said...

If you read the program you would notice it gets the MX server (Mail server from target domain) Then tries to deliver a test email as any normal email would be delivered. If server okays the email id then we are sure that particular id exist on server.
It does not get all email ids on server but it tries to check the email ids from input file given.

Albert Saini said...

this means this program check jhon1.gmail.com exit in gmail.com. for jhon1 is really an email id in gmail.com(domian)..do am right?please answer me..thankyou for reply