Use EasyMailObject component to handle Exchange mail source code in ASP---read the mail subject and size (maillist1.asp)
<%@ LANGUAGE="VBscript" %>
<%
'******************************************************
'This file lists all emails and sets the mail content display window as a blank window
'Author: awayeah
'Email: [email protected]
'******************************************************
%>
<script language=vbscript>
parent.frmbottom.location.href="blank.htm"
sub cmdel_onClick()
'Delete the email
frmail.submit
end sub
</script>
<%
if session("straccount")="" or session("strpassword")="" then
Response.write("<html><title>Error, not logged in yet</title><body><p align=center><br><br>You are not logged in yet, please log out first!<br><br>" )
Response.Write ("<a href='login.asp' target='_top'><img src='http://www.newap.net/Article/asp/example/2005/logout.jpg' border=0 >/a></p></body></html>")
Response.End
end if
%>
<html>
<head>
<title>Receive email</title>
</head>
<STYLE>
<!--
A{text-decoration:none}
-->
</STYLE>
<body bgcolor="#008080" text="#000000">
<%
'Define the mail server address
strserver=session("strserver")
'Define the account
strAccount=session("straccount")
'Define password
strPassword=session("strpassword")
'Set various properties of the component
Set POP3 = CreateObject("EasyMail.POP3.5")
POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"
POP3.MailServer = strServer
POP3.Account = strAccount
POP3.Password = strPassword
pop3.PreferredBodyFormat=1
pop3.TimeOut=120
x = POP3.Connect
If x <> 0 Then
Response.Write "<p align=center>Connection error: " + CStr(x) + "<br><br>Please contact the administrator"
POP3.Disconnect
Response.End
End If
x = POP3.DownloadMessages(0)
If x <> 0 Then
Response.Write "Download error: " + CStr(x) +"<br><br>Please contact the administrator"
POP3.Disconnect
Response.End
End If%>
<p><br></p>
<form name="frmail" action="mail_prc.asp" method="POST">
<center>
<table cellpacing="0" cellpadding="0" bordercolor="#000080" bgcolor="#FFFFF">
<tr><td colspan=6 align="center">
<%
'Pagination processing
if Request.QueryString("currentpage")="" then
cp=1
else
cp=Request.QueryString("currentpage")
end if
'Get the total number of emails
m_count=POP3.Messages.Count
if m_count<=10 then
pagenum=1
sd=1
ed=m_count
else
pagenum=int(m_count/10)+1
if clng(cp)<>pagenum then
lastpage=m_count mod 10
sd=(clng(cp)-1)*10+1
ed=clng(cp)*10
else
sd=(clng(cp)-1)*10+1
ed=m_count
end if
end if
%>
You have <font color="ff00ff"><%=POP3.Messages.Count%></font> emails. </td>
<%session("msgcount")=POP3.Messages.Count%>
</tr>
<tr>
<td align="center">number</td>
<td align="center">From/Reply</td>
<td align="center">Theme</td>
<td align="center">Date</td>
<td align="center">Size</td>
<td align="center">Select</td>
</tr>
<%for i= sd to ed%>
<tr>
<td align="center"><%=i%></td>
<%
fw="Reply:"+replace(POP3.messages.item(i).subject,space(1),"_")
%>
<td>
<%receiver=POP3.Messages.item(i).from%>
<%if POP3.Messages.item(i).fromaddr="" then%>
<a href="">
<%else
%>
<a href=#onClick=javascript:window.open('sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>','sendnew',' width=600,height=480,scrollbars=yes');>
<%end if%>
<%if trim(receiver)="" then
response.write "Anonymous</a>"%>
<%else%>
<a href=#onClick=javascript:window.open('sendmail1.asp?addr=<%=pop3.messages.item(i).fromaddr%>&subject=<%=fw%>','sendnew',' width=600,height=480,scrollbars=yes');>
<font face="宋体" size="2">
<%=POP3.Messages.item(i).From%></font>
<%end if%>
</td>
<td>
<%msgid=POP3.GetMessageID(i)%>
<a href="showbody1.asp?id=<%=msgid%>" target="frmbottom">
<font face="宋体" size="2">
<%
if trim(POP3.messages.item(i).Subject)="" then
response.write "No topic"
else
response.write POP3.messages.item(i).Subject
end if
%></font>
</a></td>
<td><font face="宋体" size="2"><%=cdate(mid(cstr(POP3.messages.item(i).date),6,11))%></font></ td>
<tdwidth="60"><font face="宋体" size="2"><%=POP3.messages.item(i).size%></font></td>
<td><input type="checkbox" name="c<%=i%>" value="<%=i%>"></td>
</tr>
<%next
POP3.Disconnect
%>
</table>
</center>
<p align="center"><input type="button" name="cmdel" value="delete"></p>
</form>
<div align="center">
<table cellpacing="0" cellpadding="0" bordercolor="#ff0080" bgcolor="#FFFFF">
<tr><td>Pages</td>
<%for i=1 to pagenum%>
<td><a href="maillist1.asp?currentpage=<%=i%>" target=frmtop> <%=i%> </a></td>
<%next%>
</tr></table></div>
</body>
</html>