载入中。。。 'S bLog
 
载入中。。。
 
载入中。。。
载入中。。。
载入中。。。
载入中。。。
载入中。。。
 
填写您的邮件地址,订阅我们的精彩内容:


 
自已用asp写了一个邮件格式检验程序
[ 2008/4/27 14:20:00 | By: 梦翔儿 ]
 

自已asp写了一个邮件格式(Email格式)检验程序,不过这种方法显然不够科学,更好的方法是用正则表达式来写,而且能在客户端执行的程序最好放在客户端执行,也就是用vbs/js脚本来实现。不过功能倒是全写出来了,嘿,背课时闲着无聊,就当练习了。

<%
dim emails
emails=Trim(Request.Form("form_email"))
if emails<>"" then
names=split(emails,"@")
 if UBound(names)<>1 then
  response.Write("邮箱地址至少有一个@,并且不能有多个@符号"&"<br>")
  response.end
 end if
dots=split(names(1),".")

  if ubound(dots)<1 then
  response.write("邮箱地址至少有一个.符号")
  response.end
 end if
 for each name in names
  if len(name)=0 then
  response.write("缺少邮箱名")
  response.end
  end if
 next
 for each name in dots
  if len(name)=0 then
   response.write("邮箱域名不完整,")
   if dots(0)="" then
    response.write("域名前缀不能为空")
   else
    response.Write("域名后缀不能为空")
   end if
   response.end
  end if
 next
   response.write("邮箱格式正确")
else
  response.Write("邮箱地址不能为空"&"<br>")
end if
 %>

js写法看这里:http://web.exiang.org/blog/user1/3/900.html

 
 
  • 标签:asp 邮件格式 检验 
  • 发表评论:
    载入中。。。

     
     
     

    梦翔儿网站 梦飞翔的地方 http://www.dreamflier.net
    中华人民共和国信息产业部TCP/IP系统 备案序号:辽ICP备09000550号

    Powered by Oblog.