asp如何在页面中实现对电子信箱的访问?
时间:2010-06-26 12:34:00
如何在页面中实现对电子信箱的访问?
emaile.htm
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<title>asp之家</title>
<style type="text/css">
<!--
td { font-size: 9pt}
body { font-size: 9pt}
select { font-size: 9pt}
A {text-decoration: none; color: #003366; font-size: 9pt}
A:hover {text-decoration: underline; color: #FF0000; font-size: 9pt}
-->
</style>
<script language="javascript">
function check(tt) {
if (window.document.form1.selectmail.selectedIndex==0) {
alert("选择电子信箱服务提供商:")
window.document.form1.selectmail.focus()
return false
}
if (tt.account.value=="") {
alert("噢,用户名不能为空!")
tt.account.focus()
return false
}
if (tt.account.value.length<3) {
alert("噢,用户名长度不能小于3位!")
tt.account.focus()
return false
}
if (tt.password.value=="") {
alert("噢,密码不能为空!")
tt.password.focus()
return false
}
if (tt.password.value.length<3) {
alert("噢,密码长度不能小于4位!")
tt.password.focus()
return false
}
else
return true
}
</script>
<BODY topmargin=12>
<table border=0 bgcolor=d3d3d3>
<td>
<form action="Email.asp" method=post Onsubmit="return check(this)" name=form1
target="_blank">
' 用target="_blank"弹出新窗口来查看信箱
<select style="font-size:9pt;background-color:add8e6" name="selectmail">
<option name="MailSite" value="www.intels.net" selected>随风起舞之在线电子信箱</option>
<option name='MailSite' value='bjweb.163.net/cgi/login?;user;pass;'>163电子邮局</option>
' 邮件服务器的URL、用户名和密码信息
<option name='MailSite' value=' 202.96.44.18 /prog/login?;user;pass;'>263天下邮</option>
<option name='MailSite' value=' mail.163.com /prog/login?;user;pass;'>网易邮件中心</option>
<option name='MailSite' value=' mail.sina.com.cn /prog/login?;user;pass;'>我的新浪邮件</option>
<option name='MailSite' value='rz169.net/cgi/login?;user;pass;'>日照信息港电子邮件</option>
…
' 添加更多哦
…
</select><br>
用户名:<input type=text name=account size=12 style="font-size:9pt"><br>
密码:<input type=password name=password size=12 style="font-size:9pt"><br>
</td><tr><td align=center><input type=submit value="看新邮件" style="font-size:9pt">
<input type=reset value="重新写过" style="font-size:9pt">
</td>
</form>
</td>
</table>
</BODY>
</HTML>
email.asp
<%@ Language=VBScript %>
<%
Response.Buffer = true
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<%
dim str(3)
str1 =trim(Request.Form("selectmail"))
' 获取邮件服务器、用户名和密码
for i = 1 to 3
' 对以上信息进行分割,并赋予给数组变量
p = instr(1,str1,";")
str(i-1) = mid(str1,1,p-1)
str1 = mid(str1,p+1)
next
if instr(1,str(0),"http://")=0 then
webSiteUrl = "http://" & str(0)
else
webSiteURL = str(0)
' 邮件服务器地址及指定处理的文件名
end if
usernam = str(1)
' 用户名变量名
password = str(2)
' 密码变量名
mailUrl = webSiteUrl & usernam & "=" & trim(Request.Form("account"))
mailUrl = mailUrl & chr(38) & password & "=" & trim(Request.Form("password"))
' 合并用户名和密码字符
Response.Redirect mailUrl
' 打开邮箱
%>
</BODY>
</HTML>