Username: Password:

在ASP中用EasyMailObject组件处理Exchange邮件源代码---读取邮件主题和大小(maillist1.asp)
来源:作者: 发布时间:2007-12-19 10:03:55

<%@ LANGUAGE="VBSCRIPT" %>
<%
’************************************************

’这个文档列出任何邮件,并把邮件内容显示窗口置为空白窗口
’作者:awayeah
’邮箱:awayeah@163.net

’************************************************
%>

<%
if session("straccount")="" or session("strpassword")="" then
Response.write("错误,尚未登录



您尚未登录,请先退出登录!

")
Response.Write ("

")
Response.End
end if
%>


收邮件



<%
’定义邮件服务器地址
strserver=session("strserver")
’定义帐号
strAccount=session("straccount")
’定义密码
strPassword=session("strpassword")
’配置组件的各种属性
  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 "

连接错误: " + CStr(x) + "

请和管理员联系"
      POP3.Disconnect
      Response.End
   End If

   x = POP3.DownloadMessages(0)
   If x <> 0 Then
      Response.Write "下载错误: " + CStr(x) +"

请和管理员联系"
      POP3.Disconnect
      Response.End
   End If%>







<%session("msgcount")=POP3.Messages.Count%>









    <%for i= sd to ed%>



<%
fw="回复:"+replace(POP3.messages.item(i).subject,space(1),"_")
%>




<%=POP3.messages.item(i).size%>


<%next
   POP3.Disconnect

%>

<%
’分页处理
if Request.QueryString("currentpage")="" then
cp=1
else
cp=Request.QueryString("currentpage")
end if
’得到邮件总数
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
%>
您有<%=POP3.Messages.Count%>封邮件。
来自/回复 主题 日期 大小 选择
<%=i%>
<%receiver=POP3.Messages.item(i).from%>
<%if POP3.Messages.item(i).fromaddr="" then%>

<%else
%>
&subject=<%=fw%>’,’sendnew’,’width=600,height=480,scrollbars=yes’);>
<%end if%>
<%if trim(receiver)="" then
response.write "匿 名
"%>
<%else%>
&subject=<%=fw%>’,’sendnew’,’width=600,height=480,scrollbars=yes’);>

<%=POP3.Messages.item(i).From%>

<%end if%>


<%msgid=POP3.GetMessageID(i)%>


<%
if trim(POP3.messages.item(i).Subject)="" then
response.write "无主题"
else
response.write POP3.messages.item(i).Subject
end if
%>

<%=cdate(mid(cstr(POP3.messages.item(i).date),6,11))%>







<%for i=1 to pagenum%>

<%next%>
页数  <%=i%> 





喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅