Effective email verification method

Published 11/1/2015 08:52:22 AM  |  Last update 11/1/2015 08:56:39 AM
Tags: email verification, dns, mx

Email verification is a key issue in business intelligence. Methods using regular expression based approach can verify the email against email structure standard. They however could not assure whether the email is real or not, making possible message delivery to fake email which seriously impacts business reputation and wastes of business IT infrastructure.

Verifying email against server email list is an alternative but more efficient approach. This approach unfortunately is not practical because such an email list is not always available. However, the idea of email verification using communication with mail servers is interesting. This ideal is applied in the two-step email verification approach I will present here.

Email domain name verification The first step of my approach is to verify the email domain name. To be valid, the email should be served by at least one mail server. It is possible to request for mail server information of a given domain. It can be done using DNS lookup for MX records of the domain. Given the email admin@tinyray.com, the following command will search for domain name mail servers:

nslookup -type=mx tinyray.com

Here's the reply from DNS server.

Non-authoritative answer:
tinyray.com     mail exchanger = 10 mailstore1.secureserver.net.
tinyray.com     mail exchanger = 0 smtp.secureserver.net.
Authoritative answers can be found from:
mailstore1.secureserver.net     internet address =
smtp.secureserver.net   internet address =

Now, it is known that one of the mail servers for “tinyray.com” domain name is at “smtp.secureserver.net”. The next step is to check the email address with the mail server. Popular communication protocols to mail server are POP3, IMAP and SMTP of which, both POP3 and IMAP required authentication to setup connection to server. They are therefore cannot be used to verify a new coming email address. I therefore used SMTP.

Email local part verification By default, SMTP server listen to client requests on port# 25. The SMTP commands to used are: HELO, MAIL FROM, RCPT TO and QUIT. You may refer this for more about SMTP commands.

telnet smtp.secureserver.net 25

Followings are responses from the mail server:

Connected to smtp.secureserver.net (
Escape character is '^]'.
220 p3plibsmtp03-01.prod.phx3.secureserver.net bizsmtp ESMTP server ready

That's fine. Now say hello to the server:

HELO tinyray

250 p3plibsmtp03-01.prod.phx3.secureserver.net hello [xxx.yyy.xxx.ttt], pleased to meet you

Tell that server you want to send an email by providing your email address. An anonymous email address is OK because mail server does not care about external email addresses.

MAIL FROM:<lnt@yahoo.com>

250 2.1.0 <lnt@yahoo.com> sender ok

That's good. Now tell the mail server that the message will be sent to one of its email addresses:

RCPT TO:<admin@tinyray.com>

550 5.1.1 <admin@tinyray.com> Recipient not found.

Alright, the server reply shows that there is no such email address. To make sure, please use the following command:

RCPT TO:<support@tinyray.com>

250 2.1.5 <support@tinyray.com> recipient ok

That's perfect. Now you can close connection to the mail server:


221 2.0.0 p3plibsmtp03-01.prod.phx3.secureserver.net bizsmtp closing connection
Connection closed by foreign host.

I have shown how to verify email address using communications with mail service servers. My approach is effective but easily implemented. Please drop me a line for any issue regarding my article. Also, please check back if you want to know how to implement my method using PHP and ASP.NET.

© 2023 blog.tinyray.com  by tinyray