nathan schmoll's
aspdiscovery

back to main page

e-mail me








Verifying e-mail addresses
Irritated by looking at a list of new subscribers to your e-mail list and finding lots of "junk" (invalid e-mail addresses)? There's a very simple way to overcome this bothersome matter. I will show you how to create a subroutine that checks the e-mail address for a valid length, an "@" symbol, and a ".". Here is the subroutine:

<%
sub checkemailvalidity(email)
if instr(email,"@")<>"0" and _
instr(email,".")<>"0" and instr(email," ")="0" _
and len(email)>4 then
emailvalid="true"
end if
end sub
%>

After you create that subroutine in your ASP page, all you must do is call it and pass along the e-mail address that you wish to verify.

<%
checkemaivalidity request.form("email")
%>

After the subroutine has processed the e-mail address you passed along to it, it will verify that the e-mail address is correct. If the e-mail address is valid, it will create a variable called "emailvalid" and give it the value "true".

This can be used for many things and is quite simple to use -- there's no reason not to use it!

copyright © 2001, nathan schmoll. all rights reserved. questions? comments? suggestions? e-mail me!