Função ValidaEmail
Galera, fiz uma função para Validar o email...
<%Function ValidaEmail(email)'##############################'# Por: Carlos Alessandro Ribeiro(rOcKLoCo) #'# Data: 22/10/2003 #'# E-mail: rock.loco@uol.com.br #'############################# email = Trim(email) if email = "" then ValidaEmail = False exit function end if if InStr(email,"@") = 0 then ValidaEmail = False exit function end if pos = InStr(email,"@") aux = Mid(email,pos+1) if InStr(aux,".") = 0 then ValidaEmail = False exit function end if Dominio = LEFT(aux,InStr(aux,".")-1) if Dominio = "" then ValidaEmail = False exit function end if Carac = Array("!","#","$","%","&","*","(",")","+","=","/","\","|","?","'","""","{","}","[","]","ª","º",":",",",";","§","°","<",">") for intVer = LBound(Carac) to UBound(Carac) if InStr(email,Carac(intVer)) > 0 then ValidaEmail = False exit function end if next ValidaEmail = TrueEnd Function%>
Para chamar a função fica assim:
<% if ValidaEmail(email) = False then response.write "erro" else response.write "ok" end if%>
falows
Discussão (4)
Carregando comentários...