您好,欢迎访问一九零五行业门户网

邮件退定功能与邮箱地址验证

dim email
email=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 if
else
  'response.write 无效的电子邮件格式,请按“后退”按钮,重填一个有效的email
  response.write
end if
function isvalidemail(email)
 dim names, name, i, c
 'check for valid syntax in an email address.
 isvalidemail = true
 names = split(email, @)
 if ubound(names) 1 then
   isvalidemail = false
   exit function
 end if
 for each name in names
   if len(name)      isvalidemail = false
     exit function
   end if
   for i = 1 to len(name)
     c = lcase(mid(name, i, 1))
     if instr(abcdefghijklmnopqrstuvwxyz_-., c)        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), .)    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
%>
其它类似信息

推荐信息