当前位置: 首页 > 图文教程 > 网络编程 > ASP > jmail4.1用pop3收信的例子

ASP
如何使用ASP产生象安装向导的主页
ADO如何取得数据库中表的字段信息之一
ADO如何取得数据库中表的字段信息之二
网页计数器的程序
实验Recordset.Movenext,Recordset.Previous,Recorset...等移动记录
不能ASP图像组件来生成图像的ASP计数器程序(一)
IIS5 + ADO 2.5新先睹为快技术(一)
IIS5 + ADO 2.5新先睹为快技术(二)
如何使用 Microsoft Access 和 Active Server Pages 加密你的页面
WINDOWS 2000搭載ASP3.0和IIS5.0
IIS 5.0新功能
网络开发之编程技巧之一(有效验证用户的登录)
如何使用ASP在自己的网站建立投票机制(一)
如何使用ASP在自己的网站建立投票机制(二)
组件对象开发Web应用的实例分析
如何实现动态添加Html文档中Form项
一个BBS的源代码(一)
一个BBS的源代码(二)
一个BBS的源代码(三)
一个BBS的源代码(四)

ASP 中的 jmail4.1用pop3收信的例子


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 57 ::
收藏到网摘: n/a

  <%  Set pop3 = Server.CreateObject( "JMail.POP3" )
  
  'pop3的连接用户名,密码,pop3地址
  pop3.Connect "username", "password", "mail.mydomain.com"

  Response.Write( "你有" & pop3.count & " 封邮件。<br><br>" )

  if pop3.count > 0 then
    Set msg = pop3.Messages.item(1)     
    ReTo = ""
    ReCC = ""
    
    Set Recipients = msg.Recipients
    separator = ", "
    
    ' 现在得到所有的收件人,并且存储
    
    For i = 0 To Recipients.Count - 1
        If i = Recipients.Count - 1 Then
            separator = ""
        End If
    
        Set re = Recipients.item(i)
        If re.ReType = 0 Then
            ReTo = ReTo & re.Name & "&nbsp;(<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" &
separator
        else
            ReCC = ReTo & re.Name & "&nbsp;(<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" &
separator
        End If
    Next
    
    '这个程序得到附件,并且保存到服务器的硬盘上。也可以返回附件的详细连接
    Function getAttachments()
          Set Attachments = msg.Attachments
          separator = ", "
    
          For i = 0 To Attachments.Count - 1
            If i = Attachments.Count - 1 Then
                separator = ""
             End If
    
             Set at = Attachments(i)
             at.SaveToFile( "c:\EMail\attachments\" & at.Filename )
             getAttachments = getAttachments & "<a href=""/EMail/attachments/" & at.Filename &""">" &_
                                 at.FileName & "(" & at.Size  & " bytes)" & "</a>" & separator
          Next
    End Function
      
    %>    
    <html>
      <body>
        <TABLE>
       &n