四种asp 电子邮箱验证函数

%dim emailemail=request.form(email)if IsValidEmail(email) then if
request(action)=退订 then response.redirect del_email.asp?email=email
else response.redirect add_email.asp?email=email end ifelse
‘response.write 无效的电子邮件格式,请按后退按键,重填三个可行的Email
response.writeSCEnclaveIPT
language=JavaScriptalert(‘无效的电子邮件格式,请重填一个卓有成效的Email!’卡塔尔;
response.writejavascript:history.go(-1卡塔尔/SCTiguanIPTend iffunction
IsValidEmail(emailState of Qatardim names, name, i, c’Check for valid syntax in an
email address.IsValidEmail = truenames = Split(email, @卡塔尔国if UBound(namesState of Qatar1 then IsValidEmail = false exit functionend iffor each name in names if
Len(nameState of Qatar = 0 then IsValidEmail = false exit function end if for i = 1
to Len(name卡塔尔 c = Lcase(Mid(name, i, 1卡塔尔(قطر‎卡塔尔(قطر‎ if
InStr(abcdefghijklmnopqrstuvwxyz_-., c) = 0 and not IsNumeric(c) then
IsValidEmail = false exit function end if next if Left(name, 1) = . or
Right(name, 1) = . then IsValidEmail = false exit function end ifnextif
InStr(names(1), .) = 0 then IsValidEmail = false exit functionend ifi =
Len(names(1)) – InStrRev(names(1), .)if i 2 and i 3 then IsValidEmail =
false exit functionend ifif InStr(email, ..) 0 then IsValidEmail =
falseend ifend function%

本小说提供的上边邮箱验证函数都是通过测量检验的诸位能够放心的运用,有用正则表明式的也可能有不是的,好了下边大家来探视那二种asp
电子邮箱验证函数是还是不是您赏识的作风吗。

本文章提供的底下邮箱验证函数都以通过测量检验的诸位能够放心的应用,有用正则表明式的也可能有不是的,好了上边大家来探视那三种asp教程
电子邮箱验证函数是否您赏识的作风吗。

Public Function IsEmail(ByVal PString)
Dim Plt,Pgt : Plt = False : Pgt = False
For x = 2 To Len(PString) – 1
If Mid(PString,x,1) = “@” Then Plt = True
If Mid(PString,x,1) = “.” And Plt = True Then Pgt = True
Next
If Plt = True And Pgt = True Then
IsEmail = True
Else
IsEmail = False
End if
End Function
%>

‘********************************************
‘函数名:IsValidEmail
‘作 用:检查Email地址合法性
澳门新葡萄京娱乐场,’参 数:email —-要反省的Email地址
‘重临值:True —-Email地址合法
‘ False —-Email地址违规
‘********************************************

Public Function IsValidEmail(Email)
Dim names, name, I, c
IsValidEmail = True
names = Split(Email, “@”)
If UBound(names) <> 1 Then IsValidEmail = False: Exit Function
For Each name In names
If Len(name) <= 0 Then IsValidEmail = False:Exit Function
For I = 1 To Len(name)
c = LCase(Mid(name, I, 1))
If InStr(“abcdefghijklmnopqrstuvwxyz_-.”, c) <= 0 And Not
IsNumeric(c) Then IsValidEmail = False:Exit Function
Next
If Left(name, 1) = “.” Or Right(name, 1) = “.” Then IsValidEmail =
False:Exit Function
Next
If InStr(names(1), “.”) <= 0 Then IsValidEmail = False:Exit
Function
I = Len(names(1)) – InStrRev(names(1), “.”)
If I <> 2 And I <> 3 Then IsValidEmail = False:Exit
Function
If InStr(Email, “..”) > 0 Then IsValidEmail = False
End Function

 

<%
Function isemail(strng)
isemail = false
Dim regEx, Match
Set regEx = New RegExp
regEx.Pattern =
“^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$”
regEx.IgnoreCase = True
Set Match = regEx.Execute(strng)
if match.count then isemail= true
End Function
%>

 

Public Function ChkMail(ByVal Email)
Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp
Rep.Pattern =
“([.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(.([a-zA-Z0-9]){2,}){1,4}$”
Pmail = Rep.Test(Email) : Set Rep = Nothing
If Not Pmail Then ChkMail = False
End Function

电子邮…

发表评论

电子邮件地址不会被公开。 必填项已用*标注