Email Address Verification on Mailserver – Proof of Concept

Here is a proof of concept to verify the existence of email address on mailbox. There are many alternatives to check the same like send email through Telnet  service using the raw SMTP commands where you can get the raw reply from the mail exchange server. Here I have used the Python SMTP library in order to test the existence of email box on mail exchange server. There are simple steps to follow and you can verify the validity of email address before sending email.

Find Email Exchange Server

In order to test you have to connect to the correct mail exchange server. You can find the host which accept the mail delivery based on the domain to which you are sending email. Lets take an example if you are sending email to  you can get email exchange server using below command.

nslookup for mail exchange

Connect and Try to Send Email

Once you have the mail exchange server, try to connect to the server on the default smtp port 25, and follow the below steps, in order to check the validity of email address based on the return code. Once you add the recipient email address if it returns 250 means you are sending to email which really exist on the server else if not exist it will return 550. get the details about more SMTP codes.

Verify Email Address
Verify Email Address

For some domain it will not return correct result i.e it always return that email is valid and exist on the serve , on which email alias are implemented and specially when ‘*’ alias implemented where any of the email will never get bounce mostly like Yahoo. Some times you are not able to connect to the exchange server because your IP is in spammers list, before running script you can check your Ip’s  blacklist status, If you found your in any of the blacklist service you may not get the correct result for domain who checking blacklist using those services.

Its better to implement email verificatione in OpenERP, specially when you are working for Marketing Campaign through emails to avoid lots of undelivered or bounce emails.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s