ASP通过JMail组件读取邮件列表

<html>
<style type="text/css">
<!--
body,td,th {
 font-size: 9pt;
}
-->
</style>
<body>  
<table width="800" border="0" cellspacing="1" cellpadding="5">
<form name="form1" method="post" action="">
    <tr>
      <td colspan="5" align="center"><h2>ASP通过JMail组件读取邮件列表</h2></td>
    </tr>
    <tr>
      <td>邮箱:
          <select name="pop3Server">
            <option value="pop.163.com" selected>163邮箱</option>
            <option value="pop.126.com">126邮箱</option>
</select>
      </td>
      <td>邮箱的登录名:
      <input name="uid" type="text" id="uid" size="15" maxlength="30"></td>
      <td>邮箱的登录密码:
      <input name="upwd" type="password" id="upwd" size="15" maxlength="30"></td>
      <td>日期:
      <input name="riqi" type="text" id="riqi" value="2010-03-17" size="12" maxlength="20"></td>
      <td><input type="submit" name="submit" id="submit" value="提交"></td>
    </tr>
    </form>
  </table>
  <table width="800" border="1" cellspacing="0" cellpadding="5">
      <tr align="center">
      <td><strong>序号</strong></td>
      <td><strong>日期</strong></td>
      <td><strong>邮件标题</strong></td>
      <td><strong>发件人</strong></td>
      <td><strong>附件</strong></td>
      <td><strong>内容</strong></td>
    </tr>
<%
if request.Form("submit")<>"" then
pop3Server=request.Form("pop3Server")
uid=request.Form("uid")
upwd=request.Form("upwd")
riqi=CDate(request.Form("riqi"))
Set pop3 = Server.CreateObject( "JMail.POP3" )
pop3.Connect uid, upwd, pop3Server  
'Response.Write( "你有" & pop3.count & " 封邮件。<br><br>" )
'set msg=server.CreateObject("jmail.message")
Function getAttachments() '获得附件
 if Attachments.Count>0 then
   Set Attachments = msg.Attachments
  getAttachments = Attachments(0).Name & "(" & Attachments(0).Size & " bytes)"
 else
 getAttachments=""
 end if
  End Function  

for i=1 to pop3.count
 Set msg = pop3.Messages.item(i)
 Set Attachments = msg.Attachments
 if CDate(msg.date)>=riqi then%>
    <tr>
      <td align="center"><%= i %></td>
      <td align="center"><%= msg.date %></td>
      <td><%= msg.Subject %></td>
      <td><%= msg.FromName %>&nbsp;</td>
      <td><%= getAttachments %>&nbsp;</td>
      <td><%'=left(msg.Body,50) %>&nbsp;</td>
    </tr>
  <%end if
  next
  pop3.Disconnect
end if%>
</table>
  </body>
  </html>

 

在线演示:http://www.aspok.net/yanshi/aspreadmail.asp

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值