Collect POP3 messages using the W3 JMail component

Source: Internet
Author: User
Tags count end connect trim
Jmail|jmail component <% @LANGUAGE =vbscript%>
<%

Dim startpage
Dim endpage
Startpage=int (Request ("Start")
Endpage=int (Request ("End"))

Set POP3 = Server.CreateObject ("JMAIL.POP3")

Uid=trim (Request ("UID")
Pwd=trim (Request ("pwd"))
Pop=trim (Request ("Pop")

If uid= "" or pwd= "" or pop= "" "Then
Response.Redirect "Receivemail.asp"
End If


If uid<> "" and Pwd<> "" and pop<> "" Then
Response.Cookies ("UID") =trim (Request ("UID")
Response.Cookies ("pwd") =trim (Request ("pwd"))
Response.Cookies ("Pop") =trim (Request ("Pop")
Else
Uid=request.cookies ("UID")
Pwd=request.cookies ("pwd")
Pop=request.cookies ("Pop")
End If
POP3. Connect uid, Pwd,pop

' POP3. Connect "agang0084", "921028", "pop3.sina.com.cn"
Response.Write "<div align=center>"
Response.Write ("Your inbox has <font color=red>" & pop3.count & "</font> message <br><br>")
Response.Write "</div>"



' Count pages
pagenum=10 ' A page coexistence of several records
If Pop3.count<pagenum Then
Pagecount=1
Else
Intcount=int (Pop3.count/pagenum)
Modcount=pop3.count MoD Pagenum
If Modcount>0 Then
Pagecount=intcount+1 ' If the total record is divided by the number of records that can be stored on one page, the pages must be one
Else
Pagecount=intcount
End If
End If

Response.Write ("Your message has a common" &pagecount& "page")


' Calculate page numbers

Page=trim (Request ("page")
If page<> "" Then
Select Case Page
Case "FirstPage"
Startpage=1
Endpage=pagenum
Case "LastPage"
Startpage= (pagecount-1) *pagenum+1
Endpage=pop3.count
Case "Next"
If endpage+10 > Pop3.count Then
Startpage= (pagecount-1) *pagenum+1
Endpage=pop3.count
Else
Startpage=startpage+10
Endpage=endpage+10
End If
Case "Back"
If Startpage=pagenum+1 Then
Startpage=1
Endpage=pagenum
Else
Startpage=startpage-10
Endpage=endpage-10
End If
End Select
Else
If Pop3.count<pagenum Then
Startpage=1
Endpage=pop3.count
Else
Startpage=1
Endpage=pagenum
End If
End If



If Pop3.count > 0 Then
Dim msg (20)
Dim Attachments (20)
For I=1 to Pop3.count
Set msg (i) = POP3. Messages.item (i)
Set Attachments (i) = MSG (i). Attachments
Next
%>
<%
If Startpage=1 Then
Response.Write "First Page"
Else
Response.Write "<a href=pop3.asp?page=firstpage&start=" &startpage& "&end=" &endpage& " > First page </a> "
End If

If Endpage=pop3.count Then
Response.Write "Next Page"
Else
Response.Write "<a href=pop3.asp?page=next&start=" &startpage& "&end=" &endpage& "> next page </a> "
End If

If Startpage=1 Then
Response.Write "Previous Page"
Else
Response.Write "<a href=pop3.asp?page=back&start=" &startpage& "&end=" &endpage& "> previous page </a> "
End If

If Endpage=pop3.count Then
Response.Write "Last Page"
Else
Response.Write "<a href=pop3.asp?page=lastpage&start=" &startpage& "&end=" &endpage& " > Last page </a> "
End If

Response.Write "Current record is from the first"
Response.Write StartPage
Response.Write "Seal to"
Response.Write EndPage
Response.Write &



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.