The email verification functions provided in this article are all tested and can be safely used by all users, now let's take a look at the asp email verification functions that you like.
The following content is provided in this article:Email verification functionAll of them have been tested and can be used with peace of mind, and there are no regular expressions. Now let's take a look at these asp tutorials.Email VerificationWhether the function is your favorite style.
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
%>
'*************************************** *****
'Function name: IsValidEmail
'Usage:Check the validity of the Email address
'Parameter: email ---- Email address to be checked
'Return value: True ---- valid Email address
'False ---- invalid Email address
'*************************************** *****
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)-faster Rev (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 _-]) {} @ ([a-zA-Z0-9 }(. ([a-zA-Z0-9]) {2,}) {} $"
Pmail = Rep. Test (Email): Set Rep = Nothing
If Not Pmail Then ChkMail = False
End Function