How can I validate email?

M

michaaal

I realize this is not solely an ASP question, but I thought you guys might
know the answer and I couldn't find anywhere else to post this. If you have
suggestions for this I am more than happy to post somewhere else.

How can I, using ASP code, validate whether or not an email address is a
real one? For example, if I have the email address called (e-mail address removed)
how can I determine if it is real?
 
S

Seth

Could just do a general patter search

some alpha chars + an @ symbol + some alpha chars + a fullstop followed by 2
or 3 letters

that' catch most of it i guess
 
E

Eric Gibson

michaaal said:
I realize this is not solely an ASP question, but I thought you guys
might know the answer and I couldn't find anywhere else to post this.
If you have suggestions for this I am more than happy to post
somewhere else.

How can I, using ASP code, validate whether or not an email address
is a real one? For example, if I have the email address called
(e-mail address removed) how can I determine if it is real?

I had the same question 6 months ago, and came to the conclusion here are 3 levels
to this:

1) To do a regexp on the email to determine if it matches syntax for a valid email
address.

Note: To really get the most fine-grained results you'd have to tokenize the
email address according to the RFC. You'd be surprised what's a valid email, and
what's not.

2) Check the MX records of the domain of the email to make sure it's a valid domain,
and is accepting email.

3) Actually connect to the MX in question, and ask the server if it's an address.

There a few options. If you want to use VBScript there are a few tutorials on the
internet... but they aren't nearly as well defined as the commercial offerings. I
bought http://www.hexillion.com/hg/HexValidEmail/, and it's great. It's simple...
and pretty cheap. For how much time I saved it was worth it.

You could use PerlScript in the ASP environment, and Perl has many modules that
effeciently do all three of these things, and they are free. So if you have
perlscript on your system and know how to install modules, go to
http://search.cpan.org and figure out which ones you'll need.

Eric
 
R

Roland Hall

in message
: michaaal wrote:
: > I realize this is not solely an ASP question, but I thought you guys
: > might know the answer and I couldn't find anywhere else to post this.
: > If you have suggestions for this I am more than happy to post
: > somewhere else.
: >
: > How can I, using ASP code, validate whether or not an email address
: > is a real one? For example, if I have the email address called
: > (e-mail address removed) how can I determine if it is real?
:
: I had the same question 6 months ago, and came to the conclusion here are
3 levels
: to this:
:
: 1) To do a regexp on the email to determine if it matches syntax for a
valid email
: address.
:
: Note: To really get the most fine-grained results you'd have to
tokenize the
: email address according to the RFC. You'd be surprised what's a valid
email, and
: what's not.
:
: 2) Check the MX records of the domain of the email to make sure it's a
valid domain,
: and is accepting email.
:
: 3) Actually connect to the MX in question, and ask the server if it's an
address.
:
: There a few options. If you want to use VBScript there are a few tutorials
on the
: internet... but they aren't nearly as well defined as the commercial
offerings. I
: bought http://www.hexillion.com/hg/HexValidEmail/, and it's great. It's
simple...
: and pretty cheap. For how much time I saved it was worth it.
:
: You could use PerlScript in the ASP environment, and Perl has many modules
that
: effeciently do all three of these things, and they are free. So if you
have
: perlscript on your system and know how to install modules, go to
: http://search.cpan.org and figure out which ones you'll need.


This still won't be a definite since there are catch-all email accounts now.
Try it with AOL, and you'll see all email addresses respond as valid.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
P

Patrice

Where it is in the whole process ?

Sometimes a mail is send at this address and the user have a link to confirm
its subscription. Depends what is the context...

Patrice
 
A

Alan Howard

Keep it simple - some alphanums, an '@', and some more alphanums with at
least one dot. Don't be tempted to use a full RegEx - it's absolutely
massive.

Alan
 
D

Dave Anderson

michaaal said:
How can I, using ASP code, validate whether or not an email address
is a real one? For example, if I have the email address called
(e-mail address removed) how can I determine if it is real?

There is really only one surefire way to know -- send mail to it and ask for
a response.

You've seen this plenty of times -- you register on a site, but your
registration does not activate until you click a link on the auto-generated
mail that results.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
M

michaaal

David,

I tried your website link and tried the sample form on the page.
I didn't seem to get any results - good or bad.

Am I doing something wrong?

Thanks!
 
A

Aaron [SQL Server MVP]

I tried your website link and tried the sample form on the page.
I didn't seem to get any results - good or bad.

Am I doing something wrong?

Quite possibly. We can't tell, because you didn't show us exactly what you
tried.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,158
Messages
2,570,881
Members
47,414
Latest member
djangoframe

Latest Threads

Top