How to use ASP to achieve mailbox Access?
Do you see this feature on some pages when you visit a Web site---you can access the site and see if there are any new messages in your free mailbox. Does this feature make you feel very exciting, very mysterious? Below, I use ASP to give an example to let you know how to achieve this function.
First you can go to some sites that provide free mail services, apply for an account and log in. When you open the mailbox, notice the contents of the Address bar. Now take 371 as an example and you'll find that the content is usually: Http://www.371.net/prog/login?user=fighter&pass=mypassword.
Where "fighter" is Your account, "MyPassword" is your password. Then we can get 3 messages from here. 1th, we got the URL and file name of the processing file: "http://www.371. Net/prog/login"; 2nd is the variable name that records your account: User; 3rd is the name of the variable that records your password: pass. Once we know this information, we have the handwritten HTML file and ASP file.
'/*html source file contents are as follows: * *
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<title>city Club Home </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 ("Please select your mailbox server!") ")
Window.document.form1.selectmail.focus ()
return False
}
if (tt.account.value== "") {
alert ("Account cannot be empty!") Please fill in. ")
Tt.account.focus ()
return False
}
if (tt.account.value.length<3) {
alert ("Account length cannot be less than 3 bits!") Please fill in. ")
Tt.account.focus ()
return False
}
if (tt.password.value== "") {
alert ("Password cannot be blank!") Please fill in. ")
Tt.password.focus ()
return False
}
if (tt.password.value.length<3) {
alert ("Password length cannot be less than 3 bits!") Please fill in. ")
Tt.password.focus ()
return False
}
Else
return True
}
</script>
<body topmargin=12>
<table border=0 bgcolor=d3d3d3>
<td>
<form action= "postoffice.asp" Method=post onsubmit= "return check (This)" Name=form1
target= "_blank" > <!--here with target= "_blank" to pop up a new window to view your mailbox-->
<select style= "font-size:9pt;background-color:add8e6" name= "Selectmail" >
<option name= "Mailsite" value= "City club convenience Post Office" selected>city Club convenience Post Office </option>
<option name= ' mailsite ' value= ' 990.net/prog/login?; User;pass; ' >990</option>
<option name= ' mailsite ' value= ' Www.371.net/prog/login?; User;pass; ' >371</option>
<option name= ' mailsite ' value= ' Www.188.net/prog/login?; User;pass; ' >188</option>
<option name= ' mailsite ' value= ' Web.163.net/cgi/login?; User;pass; ' >163</option>
<option name= ' mailsite ' value= ' Freemail.263.net/cgi/login?; User;pass; ' >263</option>
<option name= ' mailsite ' value= ' mail.777.net.cn/v2.0/html/mailbox.php3?; User;pass; ' >777</OPTION>&NBSP
<option name= ' mailsite ' value= ' Www.126.com/cgi/login?; Email;password; ' >126</OPTION>&NBSP
<option name= ' mailsite ' value= ' Www.2911.net/cgi-bin/login?; Username;password; ' >2911</OPTION>&NBSP
<option name= ' mailsite ' value= ' Hotmail.yn.cninfo.net/prog/login?; User;pass; ' > Yunnan 169</option>
<option name= ' mailsite ' value= ' Freemail.china.com/prog/login?; User;pass; ' >CHINA</OPTION>&NBSP
<option name= ' mailsite ' value= ' Freemail.hongkong.com/prog/login?; User;pass; ' > Hong Kong free email </option>
<option name= ' mailsite ' value= ' Freemail.netease.com/prog/login?; User;pass; ' >NETEASE</OPTION>&NBSP
<option name= ' mailsite ' value= ' Lc3.law5.hotmail.com/cgi-bin/dologin?; login;passwd; ' >HOTMAIL</OPTION>&NBSP
<option name= ' mailsite ' value= ' Www.netaddress.com/tpl/Door/login?; Userid;passWD; ' >USE.NET</OPTION>&NBSP
<option name= ' mailsite ' value= ' Www.88998.com/cgi-win/login?; Username;password; ' >88998.COM</OPTION>&NBSP
<option name= ' mailsite ' value= ' www.mail.com/mailcom/login.jhtml?; MN;PW; ' > @mail. com</option>
</select><br>
Account number: <input type=text name=account Size =12 style= "font-size:9pt" ><br>
Password: <input type=password name=password size=12 style= "font-size : 9pt "><br>
</td><tr><td align=center><input type=submit value=" Receipt "style=" Font-size:9pt ">
<input type=reset value=" refill "style=" font-size:9pt ">&NBSP;
</td>
</form>
</td>
</table>
</body>
</HTML> &NBSP
'/*html source file content End */
/*postoffice.asp source files are as follows: */
<%@ language=vbscript%>
<%
Response.Buffer = true
'----------------------------------------------------
' Author:Peter.yu &NBSP
' Created date:2000/3/13
' File name:postoffice.asp
' all Rights Reserved. Ownership belongs to City CLUB&NB Sp
'----------------------------------------------------
%>
< HEAD>&NBSP
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >&NBSP;
</HEAD>
<title>city Club Convenience Post Office (all Rights reserved ownership to City Club) </title>
<body>
< %
Dim str (3)
str1 =trim (Request.Form ("Selectmail")) '/* get mail server and user account and password information */
For i = 1 to 3 ' /* The information obtained above is segmented and given to the array variable */
p = InStr (1,str1, ";") &NBSP
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) '/* Mail server address and specified file name for processing */&N Bsp
End if
Usernam = str (1) '/* account variable name */
Password = str (2) '/* Password change name */
'/* merge characters, get such as "HTTP://WW W.371.net/prog/login?user=fighter&pass=mypassword character "*/
Mailurl = websiteurl & Usernam &" = " & Trim (Request.Form ("account"))
Mailurl = mailurl & Chr (PDF) & password & "=" & Trim (Request). Form ("password")
Response.Redirect mailurl '/* Open mailbox */
%>
</body>
'/*postoffice.asp source file content End */