分享

电子邮件email验证代码-asp

 babbooky 2010-06-04
function IsValidEmail(email)

  dim names, name, i, c

  IsValidEmail = true

  names = Split(email, "@")

  if UBound(names) <> 1 then

  IsValidEmail = false

  exit function

  end if

  for each name in names

  if Len(name) <= 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 if

  next

  if InStr(names(1), ".") <= 0 then

  IsValidEmail = false

  exit function

  end if

  i = Len(names(1)) - InStrRev(names(1), ".")

  if i <> 2 and i <> 3 then

  IsValidEmail = false

  exit function

  end if

  if InStr(email, "..") > 0 then

  IsValidEmail = false

  end if

  end function

  

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多