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

ASP
发送带附件的HTML格式邮件例程
调用winzip命令行对上传的多个文件打包压缩
怎样做自己的二级域名(之一)
怎样做自己的二级域名(之二)
怎样做自己的二级域名(之三)
从新浪提取上海天气的vbs
列出服务器上的打印机
2栏分页显示(附显示的形式[1][2])
2栏分页显示(附显示的形式前页,后页)
购物车范例(购物车页面 )
购物车范例(处理页面)
GB码和BIG5码的互换技术
在ASP中改善动态分页的性能
利用ASP实现对表的分页浏览(上)
利用ASP实现对表的分页浏览(下)
ASP后台快速调用Mysql 数据库
网络寻呼机数据库版发送消息tomessage.asp
网络寻呼机数据库版处理发送消息SubmitMessage.asp
网络寻呼机数据库版显示消息showmessage.asp
网络寻呼机数据库版显示历史消息history.asp

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 46 ::
收藏到网摘: 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