ASP email script to check if an email exists

I am using classic ASP and would like to know if there is a script to check if an email account exists without actually sending an email to that email account.
Who is Participating?
pateljituConnect With a Mentor Commented:
The only way to achieve this is via MXrecord for mail server, there are component available that can lookup MX records for e.g. AspEmail 5.3

Take a look at this article, this component had method call ValidateAddressMX which will validate if email is valid.

Other component only validate mailserver DNS

There are few sample available in DOTNET world for free, not sure if that would help for your project but still take a look at this article: (paid)
mike99cAuthor Commented:
The ASPEmail method is what I was after. Luckily it is available on the non premium version.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
This is after the question is accepted but I wanted to add...
If all you wanted to do is check if an email address field looks like it should be an email, you don't need to use any 3rd party components.
    Function isEmailValid(email) 
        Set regEx = New RegExp 
        regEx.Pattern = "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w{2,}$" 
        isEmailValid = regEx.Test(trim(email)) 
    End Function 
' now, test it: 
    Function testEmail(email) 
        response.write "<p>" & email & " (" & _ 
            isEmailValid(email) & ")" 
    End Function 

Open in new window

This would be a good function to run if you want to make sure somebody enters what looks like a good email.
mike99cAuthor Commented:
Hi Scott, thanks for this but I wasn't actually looking to validate the email syntax, I know this already. I wanted a way to find out if the email actually existed.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
As noted, that method it is not accurate.  The only real way to verify is to send them an email to click on or respond to something.   What if the domain is set up with a catch all?

ASP Classic does not give us that tool.  But you can access the command line via asp. You still can do this without a component.  

The hard way would be using classic asp directly

In this case, you would send a command like nslookup  – type=mx to get the mx record.   Once you have that, send some commands to the server telnet 25 including a from and to and get a response.  

In classic asp you would need to first generate a text file using file system object, dynamically write out the script, then run and read and run again...

This can be done much easier using .net or php.  Let's take this project for example  Just create a php page and set the hard coded variables to accept get or post data.  To access you can use either xmlhttp which would be done in the background or you could do a js/jquery ajax post.

If you are interested, there are ways around having to use components.  I used to use aspEmail too as well as aspJPEG and aspUpload so I understand if you have those already it makes it easy.  But if you can do it without components it makes it easier in the long run.

The important thing is you have it working, this is just an alternative.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.