用Jmail做收取邮件附件的程序

    我现在自己在用asp做一个web邮件处理程序,就和网上263,163的web电子邮箱。
    我在制作自己的web邮件系统的时候,使用的是网上很流行的asp邮件处理组件aspmail和jmail分别作web邮件的发件和收件程序,现在的问题就是我在用我做的web收件程序收一个带有附件的邮件的时候,下载下来的附件会被损坏(比如说:我在邮件中粘贴一个50k大小的jpg图片附件,但用web程序收下来的时候图片大小就变成40k的了,并且图片打开后看不到东西),我原先是以为jmail这个收邮件组件本身有Bug,但我又用了其他的用在asp里的收邮件组件,还是老样子。
    另外需要说明的是邮件本身没问题,我用邮件客户端软件收这个邮件时都没问题。
    下面是我的程序的一个demo,不知道你有没有这方面的编程经验,帮我解决这个问题。
<% @LANGUAGE=VBSCRIPT %>
<%
  Set pop3 = Server.CreateObject( "JMail.POP3" )            '创建对象
  pop3.Connect "pzhou", "pzhou", "10.157.11.42"             '连接服务器  pop3.connect user,password,host
  Response.Write( "You have " & pop3.count & " mails in your mailbox!<br><br>" )
  set msg=server.CreateObject("jmail.message")
  if pop3.count > 0 then
    Set msg = pop3.Messages.item(1)     
    separator = ", "
    Function getAttachments()                               '获得附件
          Set Attachments = msg.Attachments
          separator = ", "
        Response.Write "<br>"&msg.size&"<br>"
          For i = 0 To Attachments.Count - 1
            If i = Attachments.Count - 1 Then
                separator = ""
             End If
             Set at = Attachments(i)
             at.SaveToFile( "e:\" & at.Name )
             getAttachments = getAttachments & "<a href=""" & at.Name &""">" &_
                                 at.Name & "(" & at.Size  & " bytes)" & "</a>" & separator
          Next
    End Function
    %>    
    <html>
      <body>
        <TABLE>
          <tr>
            <td>Subject</td>
            <td><%= msg.Subject %></td>
          </tr>
          <tr>
            <td>From</td>
            <td><%= msg.FromName %></td>
          </tr>
          <tr>
            <td>Attachments</td>
            <td><%= getAttachments %></td>
          </tr>
          <tr>
            <td>Body</td>
            <td><pre><%= msg.Body %></pre></td>
          </tr>        
        </TABLE>
      </body>
    </html>
    <%
  end if
  pop3.Disconnect
%>

300*300
 文章首页关于迷茫时代关于我写意人生
版权所有:迷茫时代 All rights reserved   
执行时间:0.00521 秒