熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 電子郵箱email驗證實例程序

2013-11-13 10:35:05  來源: .NET編程 

  電子郵箱email驗證實例程序
function IsValidEmail(email)
dim names name i c
Check for valid syntax in an email address
IsValidEmail = true
names = Split(email "@")
if UBound(names) <> then
   IsValidEmail = false
   exit function
end if
for each name in names
   if Len(name) <= then
     IsValidEmail = false
     exit function
   end if
   for i = to Len(name)
     c = Lcase(Mid(name i ))
     if InStr("abcdefghijklmnopqrstuvwxyz_" c) <= and not IsNumeric(c) then
       IsValidEmail = false
       exit function
     end if
   next
   if Left(name ) = "" or Right(name ) = "" then
      IsValidEmail = false
      exit function
   end if
next
if InStr(names() "") <= then
   IsValidEmail = false
   exit function
end if
i = Len(names()) InStrRev(names() "")
if i <> and i <> then
   IsValidEmail = false
   exit function
end if
if InStr(email "") > then
   IsValidEmail = false
end if

  end function


From:http://tw.wingwit.com/Article/program/net/201311/14046.html
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.