View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AMDRIT AMDRIT is offline
external usenet poster
 
Posts: 31
Default Validate an Email Address

take a look at dnsstuff.org. You could possible simulate a form post and
read the response via xmlHttp.

Otherwise, you could simulate the handshake with a given SMTP server and
perform the whois.

have a look at http://www.vbip.com/winsock-api/ to get you started on
implementing winsock.

sample flow

1. validate smtp address format

2. perform DNS Lookup of the domain to see if it exists
3. perform MX Lookup of the domain to see if it has a mailexchanger exposed
(get the one with the lowest meteric)

4.
(
connect to the MX server
issue a Helo [<"Domain you are talking to"]
read response if 250 then issue a MAIL FROM: <"someemailaddress"
read response if 250 then issue a RCPT TO:
<"email_address_you_are_testing"
read response if 250 then
email address exists, or the server is not telling us
else
email address doesn't exist
issue Quit
close connection
)

Using an api winsock will make deployment easier then requiring the winsock
control to be install on target machines. Using API have risks that you
should be aware of. First, improper calls can crash you application and
cause data loss or they can provide you with a nice BSOD with a
unitelligable GPF.

Error handling is your friend, comment your code (because if you do, it
forces you to rationalize what you are doing to maintain focus.) Remeber,
with API's, if you issue an open of some sort, you should call the
appropriate close routine when you are done. API's do not have "auto
cleanup".

Sockets are asynchronous by design, once you issue a command, you will not
have immediate feedback and will therefore be blocking until a response is
returned. Not all bad SMTP response codes are bad, and perhaps you should
issue the command again to try for a positive response.

HTH

"Duncan" wrote in message
oups.com...
Hi Guys,

I wondered if it was possible to design a simple form with one textbox
and a submit button that would validate an email address put in the
textbox to see if it was a correct email address. (i dont mean the
syntax/format, but actually a real email address)

I have seen an article on how to do it in PHP
(http://www.sitepoint.com/article/use...il-address-php) but I would
prefer to do it through a userform

Does anyone know if this is possible?

Duncan