我现在自己在用ASP做一个Web邮件处理程序,就和网上263,163的web电子邮箱。 我在制作自己的web邮件系统的时候,使用的是网上很流行的asp邮件处理组件aspmail和jmail分别作web邮件的发件和收件程序,现在的问题就是我在用我做的web收件程序收一个带有附件的邮件的时候,下载下来的附件会被损坏(比如说:我在邮件中粘贴一个50k大小的jpg图片附件,但用web程序收下来的时候图片大小就变成40k的了,并且图片打开后看不到东西),我原先是以为jmail这个收邮件组件本身有Bug,但我又用了其他的用在asp里的收邮件组件,还是老样子。 另外需要说明的是邮件本身没问题,我用邮件客户端软件收这个邮件时都没问题。 下面是我的程序的一个demo,不知道你有没有这方面的编程经验,帮我解决这个问题。 <%@LANGUAGE=VBSCRIPT%> <% Setpop3=Server.CreateObject('JMail.POP3')'创建对象 pop3.Connect'pzhou','pzhou','10.157.11.42''连接服务器pop3.connectuser,password,host Response.Write('Youhave'&pop3.count&'mailsinyourmailbox!<br><br>') setmsg=server.CreateObject('jmail.message') ifpop3.count>0then Setmsg=pop3.Messages.item(1) separator=',' FunctiongetAttachments()'获得附件 SetAttachments=msg.Attachments separator=',' Response.Write'<br>'&msg.size&'<br>' Fori=0ToAttachments.Count-1 Ifi=Attachments.Count-1Then separator='' EndIf Setat=Attachments(i) at.SaveToFile('e:'&at.Name) getAttachments=getAttachments&'<ahref='''&at.Name&'''>'&_ at.Name&'('&at.Size&'bytes)'&'</a>'&separator Next EndFunction %> <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> <% endif pop3.Disconnect %>
|