Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP email script to check if an email exists

Posted on 2014-02-12
5
Medium Priority
?
2,068 Views
Last Modified: 2014-02-12
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.
0
Comment
Question by:mike99c
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 39853488
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 http://www.aspemail.com/manual_02.html#2_4, this component had method call ValidateAddressMX which will validate if email is valid.

Other component only validate mailserver DNS http://www.aspfusion.net/advmx-d.htm.

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:
http://www.codicode.com/art/free_asp_net_email_validator_verifier.aspx
http://cobisi.com/email-validation/.net-component (paid)
0
 

Author Closing Comment

by:mike99c
ID: 39853754
The ASPEmail method is what I was after. Luckily it is available on the non premium version.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39854069
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.

http://classicasp.aspfaq.com/email/how-do-i-validate-an-e-mail-address.html
<% 
    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 
 
    testEmail("bob") 
    testEmail("aaron@!whatever.com") 
    testEmail("aaron@whatever.com") 
%>

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.
0
 

Author Comment

by:mike99c
ID: 39854147
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.
0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39854376
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 http://www.labnol.org/software/verify-email-address/18220/

In this case, you would send a command like nslookup  – type=mx gmail.com to get the mx record.   Once you have that, send some commands to the server telnet gmail-smtp-in.l.google.com 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...  http://classicasp.aspfaq.com/general/how-do-i-execute-a-dos-command/batch-file/exe-from-asp.html

This can be done much easier using .net or php.  Let's take this project for example https://code.google.com/p/php-smtp-email-validation/  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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question