网络编程 
首页 > 网络编程 > 浏览文章

如何用POP3接收电子邮件?

(编辑:jimmy 日期: 2024/9/21 浏览:3 次 )

<%  Set pop3 = Server.CreateObject( "JMail.POP3" )

  pop3.Connect "username", "password", "pop3mail.intels.net"
  ' POP3的连接用户名,密码,POP3地址.

  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 & "(<a href=""mailto:"& re.EMail &""">" & re.EMail & "</a>)" &
separator
        else
            ReCC = ReTo & re.Name & "(<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:\intels\email\attachments\" & at.Filename )
            getAttachments = getAttachments & "<a href=""/intels/email/attachments/" & at.Filename &""">" &_
                                at.FileName & "(" & at.Size  & " bytes)" & "</a>" & separator
          Next
    End Function

' 以上是程序得到附件,并保存到服务器上,也可返回附件链接.

    %>   
    <html>
      <body>
        <TABLE>
          <tr>
            <td>主题:撼雪喷云向你问好!</td>
            <td><%= msg.Subject %></td>
          </tr>
          <tr>
            <td>发件人:李雁冰@163.net</td>
            <td><%= msg.FromName %></td>
          </tr>
          <tr>
            <td>收件人:宋颜浩@163.net</td>
            <td><%= ReTO %></td>
          </tr>
          <tr>
            <td>抄送:申朝阳@163.net</td>
            <td><%= ReCC %></td>
          </tr>
          <tr>
            <td>附件:随风起舞的传说</td>
            <td><%= getAttachments %></td>
          </tr>
          <tr>
            <td>内容:乌里哇啦乌里哇啦……</td>
            <td><pre><%= msg.body %></pre></td>
          </tr>       
        </TABLE>
      </body></html>

<%  end if
  pop3.Disconnect
%>

[1]

上一篇:如何用组件实现自动发送电子邮件?
下一篇:如何用ASP发送带附件的邮件?
一句话新闻
微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap