ok.thanks rstelma
now can you give me asp.net email function
I USED before the asp version:
Private Function IsEmail(byVal mailaddress)
Dim tmp, x, y, bErr, tmp2, objReg
Dim objMatch, z, i
bErr = False
tmp = Trim( mailaddress )
tmp = CStr( mailaddress )
if len(tmp) < 6 then
IsEmail = "True"
Exit Function
end if
If instr(tmp, "@") then
x = instr(tmp, "@")
y = instr(x + 1, tmp, "@")
'On Error Resume Next
y = CLng(y)
If Err Then bErr = True Else bErr = False
On Error GoTo 0
If bErr Then
IsEmail = "True"
Exit Function
End If
if y <> 0 then
IsEmail = "True"
Exit Function
end if
Else
IsEmail = "True"
Exit Function
End If
If InStr( Left( tmp, CLng(x) ), "." ) Then
IsEmail = "gg"
Exit Function
Else
tmp2 = Right( tmp, Len(tmp) - CLng(x) )
If InStr( tmp2, "." ) Then
Set objReg = New RegExp
With objReg
.Global = True
.IgnoreCase = True
.Pattern = "[A-Z]|[0-9]"
Set objMatch = .Execute(tmp2)
End With
If objMatch.Count = 0 then
IsEmail = "True"
Exit Function
End If
Set objMatch = Nothing
Set objReg = Nothing
Else
IsEmail = "True"
Exit Function
End If
End If
z = InStr( tmp, "." )
tmp2 = Right( tmp, Len(tmp) - z )
Set objReg = New RegExp
With objReg
.Global = True
.IgnoreCase = True
.Pattern = "[A-Z][A-Z]"
Set objMatch = .Execute(tmp2)
End With
If objMatch.Count = 0 then
IsEmail = "True"
Exit Function
End If
Set objMatch = Nothing
Set objReg = Nothing
For i = 1 to Len(tmp)
tmp2 = Mid( tmp, i, 1 )
Select Case tmp2
Case "(", ")", ";", ":", ",", "/", "'", chr(34), _
"~", "`", "!", "#", "$", "%", "^", "&", "*", _
"+", "=", "[", "]", "{", "}", "|", "\", "?", _
" ", "<", ">"
IsEmail = "True"
Exit Function
Case Else
End Select
Next
IsEmail = ""
End Function
|