如何用POP3接收电子邮件?

发布时间:2022-04-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了如何用POP3接收电子邮件?脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

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

  pop3.Connect "username", "password", "pop3mail.Intels.net"
  ' POP3@H_777_5@的连接用户名,密码,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]

脚本宝典总结

以上是脚本宝典为你收集整理的如何用POP3接收电子邮件?全部内容,希望文章能够帮你解决如何用POP3接收电子邮件?所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: