ASP Source Code ASP File: iasppop3.asp |
กก
|
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="#F0A080">
<p align="center"><big><big>Welcome to Use Halcyon AspPOP3
Mail Receiver</big></big></p>
<%
dim FixUpItems
if Request.form("host")<>"" and
Request.form("uid")<>"" and
Request.form("pwd")<>"" then
strHost = Request.Form("host")
strUid = Request.Form("uid")
strPwd = Request.Form("pwd")
Session("value")=Request.Form("maildir")
strMsgNo = Request.QueryString("msgno")
strDeleteNo = Request.QueryString("deletemsg")
if (strMsgNo <> "") then
Response.Write
"<h2>Message #" & strMsgNo & "
follows:</h2><pre>"
Set Mailer =
Server.CreateObject("POP3svg.Mailer")
strMailBaseDir=Trim(Request.Form("maildir"))
if InStr
(strMailBaseDir,"\") <>0 then
if Right(strMailBaseDir,1)<>"\" then
strMailBaseDir=strMailBaseDir +"\"
end if
else if
InStr(strMailBaseDir,"/")<>0 then
if Right(strMailBaseDir,1)<>"/" then
strMailBaseDir=strMailBaseDir +"/"
end if
end if
end if
Mailer.MailDirectory =
strMailBaseDir
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
Mailer.OpenPop3
strFileName = strMsgNo &
".txt"
Response.Write strMsgNo &
"<br>"
Mailer.RetrieveToFile
strMsgNo , strFileName
Mailer.ClosePop3
Set FileObject =
CreateObject("Scripting.FileSystemObject")
Set MsgFile =
FileObject.OpenTextFile(strMailBaseDir & strFileName, 1, False, True)
Do While
MsgFile.AtEndOfStream <> True
strMsgLine = MsgFile.ReadLine
Response.Write strMsgLine & "<br>"
Loop
MsgFile.Close
Response.Write "</pre>"
Mailer.EraseFile(strMailBaseDir & strFileName)
else
if (strDeleteNo <> "") then
Response.Write
"<b>Deleting Message #" & strMsgNo & " From
Server</b><p>"
Set Mailer =
Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
Mailer.OpenPop3
response.write "str msg " &
strmsgno
Mailer.Delete strDeleteNo
Mailer.ClosePop3
Response.Write
"<h2>Messages Currently On Server: " & strHost &
"</h2>"
Set Mailer =
Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
Mailer.OpenPop3
if Mailer.GetPopHeaders then
Response.Write "<table border=1 width=""90%"">"
Response.Write "<tr>"
Response.Write "<td><b>" & "Msg #" &
"<b></td>"
Response.Write "<td><b>" & "Subject" &
"<b></td>"
Response.Write "<td><b>" & "Date" &
"<b></td>"
Response.Write "<td><b>" & "From" &
"<b></td>"
Response.Write "<td><b>" & "Size" &
"<b></td>"
Response.Write "<td><b>" & "Status" &
"<b></td>"
Response.Write "<td><b>" & "Delete" &
"<b></td>"
Response.Write "</tr>"
varArray = Mailer.MessageInfo
if VarType(varArray) <> vbNull And IsEmpty(varArray) <> True then
ArrayLimit = UBound(varArray)
For I = 0 to ArrayLimit
Response.Write "<tr>"
strMsgNo = Trim(varArray(I,0))
Randomize
intRndNo = Int(500 * Rnd)
Response.Write "<td align=right>" & strMsgNo &
"</td>"
strSubject = varArray(I,1)
if strSubject = "" then
strSubject = "(No Subject)"
end if
dim strValue, strOldValue, strNewValue
strValue=strSubject
strOldValue="<"
strNewValue="<"
dim Subst
intLoc = InStr(strValue, strOldValue)
While intLoc > 0
if intLoc > 1 then
if intLoc = Len(strValue) then
strValue = Left(strValue, intLoc-1) & strNewValue
else
strValue = Left(strValue, intLoc -1) & strNewValue & Right(strValue,
Len(strValue)-(intLoc-Len(strOldValue)+1))
end if
else
strValue = strNewValue & Right(strValue, Len(strValue)-1)
end if
intLoc = InStr(strValue, strOldValue)
Wend
Subst = strValue
if strSubject <> "" then
strSubject = Subst
strSubject= Subst
FixUpItems = strSubject
else
FixUpItems = "<br>"
end if
Response.Write "<td align=left>" & "<a
href=pop3.asp?msgno=" & strMsgNo & "&rndno=" & intRndNo
& ">" & FixUpItems & "</a></td>"
Response.Write "<td align=left>" & varArray(I,2) &
"</td>"
if varArray(I,3) <> "" then
strValue=varArray(I,3)
strOldValue="<"
strNewValue="<"
intLoc = InStr(strValue, strOldValue)
While intLoc > 0
if intLoc > 1 then
if intLoc = Len(strValue) then
strValue = Left(strValue, intLoc-1) & strNewValue
else
strValue = Left(strValue, intLoc -1) & strNewValue & Right(strValue,
Len(strValue)-(intLoc-Len(strOldValue)+1))
end if
else
strValue = strNewValue & Right(strValue, Len(strValue)-1)
end if
intLoc = InStr(strValue, strOldValue)
Wend
Subst = strValue
varArray(I,3) = Subst
varArray(I,3)= Subst
FixUpItems = varArray(I,3)
else
FixUpItems = "<br>"
end if
Response.Write "<td align=left>" & FixUpItems &
"</td>"
Response.Write "<td align=left>" & varArray(I,7) &
"</td>"
strStatus = varArray(I,8)
if (strStatus = "") then
strStatus = "<b>Unread</b>"
else
strStatus = varArray(I,8)
end if
Response.Write "<td align=left>" & strStatus &
"</td>"
Response.Write "<td align=left>" & "<a
href=pop3.asp?deletemsg=" & strMsgNo & "&rndno=" & intRndNo
& ">Delete</a></td>"
Response.Write "</tr>" & Chr(10) & Chr(13)
Next
else
Response.Write "<tr><td colspan=10 align=center><b>No messages on
server</b></tr>"
end if
Response.Write "</table>"
else
Response.Write Mailer.Error
end if
Response.Write "</blockquote>"
else
Response.Write
"<h2>Messages Currently On Server: " & strHost &
"</h2>"
Set Mailer =
Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = strHost
Mailer.UserName = strUid
Mailer.Password = strPwd
Mailer.OpenPoP3
if Mailer.GetPopHeaders then
Response.Write "<table border=1 width=""90%"">"
Response.Write "<tr>"
Response.Write "<td><b>" & "Msg #" &
"<b></td>"
Response.Write "<td><b>" & "Subject" &
"<b></td>"
Response.Write "<td><b>" & "Date" &
"<b></td>"
Response.Write "<td><b>" & "From" &
"<b></td>"
Response.Write "<td><b>" & "Size" &
"<b></td>"
Response.Write "<td><b>" & "Status" &
"<b></td>"
Response.Write "<td><b>" & "Delete" &
"<b></td>"
Response.Write "</tr>"
varArray = Mailer.MessageInfo
if VarType(varArray) <> vbNull And IsEmpty(varArray) <> True then
ArrayLimit = UBound(varArray)
For I = 0 to ArrayLimit
Response.Write "<tr>"
strMsgNo =Trim(varArray(I,0))
Randomize
intRndNo = Int(500 * Rnd)
Response.Write "<td align=right>" & strMsgNo &
"</td>"
strSubject =varArray(I,1)
if strSubject = "" then
strSubject = "(No Subject)"
end if
strValue=strSubject
strOldValue="<"
strNewValue="<"
intLoc = InStr(strValue, strOldValue)
While intLoc > 0
if intLoc > 1 then
if intLoc = Len(strValue) then
strValue = Left(strValue, intLoc-1) & strNewValue
else
strValue = Left(strValue, intLoc -1) & strNewValue & Right(strValue,
Len(strValue)-(intLoc-Len(strOldValue)+1))
end if
else
strValue = strNewValue & Right(strValue, Len(strValue)-1)
end if
intLoc = InStr(strValue, strOldValue)
Wend
Subst = strValue
if strSubject <> "" then
strSubject = Subst
strSubject= Subst
FixUpItems = strSubject
else
FixUpItems = "<br>"
end if
Response.Write "<td align=left>" & "<a
href=pop3.asp?msgno=" & strMsgNo & "&rndno=" & intRndNo
& ">" & FixUpItems & "</a></td>"
Response.Write "<td align=left>" & varArray(I,2) &
"</td>"
if varArray(I,3) <> "" then
strValue=varArray(I,3)
strOldValue="<"
strNewValue="<"
intLoc = InStr(strValue, strOldValue)
While intLoc > 0
if intLoc > 1 then
if intLoc = Len(strValue) then
strValue = Left(strValue, intLoc-1) & strNewValue
else
strValue = Left(strValue, intLoc -1) & strNewValue & Right(strValue,
Len(strValue)-(intLoc-Len(strOldValue)+1))
end if
else
strValue = strNewValue & Right(strValue, Len(strValue)-1)
end if
intLoc = InStr(strValue, strOldValue)
Wend
Subst = strValue
varArray(I,3) = Subst
varArray(I,3)= Subst
FixUpItems = varArray(I,3)
else
FixUpItems = "<br>"
end if
Response.Write "<td align=left>" & FixUpItems &
"</td>"
Response.Write "<td align=left>" & varArray(I,7) &
"</td>"
strStatus = varArray(I,8)
if (strStatus = "") then
strStatus = "<b>Unread</b>"
else
strStatus = varArray(I,8)
end if
Response.Write "<td align=left>" & strStatus &
"</td>"
Response.Write "<td align=left>" & "<a
href=pop3.asp?deletemsg=" & strMsgNo & "&rndno=" & intRndNo
& ">Delete</a></td>"
Response.Write "</tr>" & Chr(10) & Chr(13)
Next
else
Response.Write "<tr><td colspan=10 align=center><b>No messages on
server</b></tr>"
end if
Response.Write "</table>"
else
Response.Write Mailer.Error
end if
Response.Write
"</blockquote>"
end if
end if
else%>
<table border=0>
<form action=""pop3.asp"" method=post>
<tr><td>Enter POP3 Mail Host:<td><input
type=text size=45 name=host value="">
<tr><td>Enter POP3 User Name:<td><input
type=text size=45 name=uid value="">
<tr><td>Enter POP3 Password:<td><input
type=password size=45 name=pwd value="">
<tr><td>Enter POP3
MailDirectory:<td><input type=text size=45 name=maildir value="<%=Session("value")%>">
<input type="Submit">
</form>
</table>
<%end if%>
</BODY>
</HTML>