欢迎来到入门教程网!

编程问答

当前位置:主页 > 网络编程 > 编程问答 >

如何用POP3接收电子邮件?

来源:本站原创|时间:2020-01-11|栏目:编程问答|点击:

<%  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<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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

    %>   
    <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]

上一篇:如何使用表单发送电子邮件?

栏    目:编程问答

下一篇:如何实现全文检索?

本文标题:如何用POP3接收电子邮件?

本文地址:https://www.xiuzhanwang.com/a1/bianchengwenda/12102.html

网页制作CMS教程网络编程软件编程脚本语言数据库服务器

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

Copyright © 2002-2020 脚本教程网 版权所有