Is it a valid email address?

 
Basic email checker
<% 
Wemail="a@aa.us"
test1=instr(Wemail, "@")                   ' value must be >1
test2=instr(Wemail, ".")                      ' value must be >4
test3=len(Wemail)                              ' value must be >6
test4=InStr (test1,Wemail,".",1)        ' value must be >test1 2
 

if test1<2 OR test2<5 OR test3<7 OR test4<test1 3 then
response.write(Wemail & " is not a valid email address")
else
response.write(Wemail & " is a valid email")
end if 
%>

This script will allow to check emails from a form

isemail2.asp
<%
if request.form("email")="" then 
Sendform()
else
IsEmail(request.form("email"))
end if
Sendform()
%>

<% Sub Sendform() %>
<form method=post action="isemail.2">
Type email address<BR>
<input type=text size=20 name=email><br>
<input type=submit value="Is it a valid email">
<form>
<% end Sub %>

<% 
Sub IsEmail (Wemail)
test1=instr(Wemail, "@")                   ' value must be >1
test2=instr(Wemail, ".")                      ' value must be >4
test3=len(Wemail)                              ' value must be >6
test4=InStr (test1,Wemail,".",1)        ' value must be >test1 2
 

if test1<2 OR test2<5 OR test3<7 OR test4<test1 3 then
response.write(Wemail & " is not a valid email address")
else
response.write(Wemail & " is a valid email")
end if 
end Sub
%>


AspTutorial.info.