我的人生路  
日历
<2005年7月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
统计
  • 随笔 - 74
  • 文章 - 57
  • 评论 - 7
  • 引用 - 0

导航

常用链接

留言簿(5)

随笔分类

随笔档案

文章分类

文章档案

相册

颜色

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
<%  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>
          <tr>
            <td>邮件标题</td>
            <td><%= msg.Subject %></td>
          </tr>
          <tr>
            <td>发件人</td>
            <td><%= msg.FromName %></td>
          </tr>
          <tr>
            <td>收件人</td>
            <td><%= ReTO %></td>
          </tr>
          <tr>
            <td>抄送</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

%>


欢迎大家访问我的个人网站 萌萌的IT人
posted on 2005-07-07 15:12 一天一点爱恋 阅读(179) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © 一天一点爱恋 Powered by: 博客园 模板提供:沪江博客