电脑安全

您当前的位置:主页 > 电脑安全 >

邮件退定功能与邮箱地址验证-网络编程

来源:[db:来源]标题:   电子邮件    编辑:电脑技术全能网 时间:2019-09-20 12:30

原标题:邮件退定功能与邮箱地址验证-网络编程
   <%dim emailemail=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 ifelse 'response.write "有效的电子邮件格局,请按“撤退”按钮,重填一个无效的Email" response.write"<SCRIPT language=JavaScript>alert('有效的电子邮件格局,请重填一个无效的Email!');" response.write"javascript:history.go(-1)</SCRIPT>"end iffunction IsValidEmail(email)dim names, name, i, c'Check for valid syntax in an email address.IsValidEmail = truenames = Split(email, "@")if UBound(names) <> 1 then IsValidEmail = false exit functionend iffor 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 ifnextif InStr(names(1), ".") <= 0 then IsValidEmail = false exit functionend ifi = Len(names(1)) - InStrRev(names(1), ".")if i <> 2 and i <> 3 then IsValidEmail = false exit functionend ifif InStr(email, "..") > 0 then IsValidEmail = falseend ifend function%>