当前位置:开发者网络 >> 技术教程 >> 网管专栏 >> 邮件服务 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
为imail和Mdaemon设计Webmail---保存附件(saveatt.asp)
作者:未知
日期:2004-06-10
人气:
投稿:Andy.m(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
为imail和Mdaemon设计Webmail---保存附件(saveatt.asp)
<%@ Language=VBScript %>
<%
'*********************************

'这是保存附件所调用的文件,要用FileSystemObject组件,指定一个存放附件临时文件的目录,
  '这个目录要WEB共享,把附件先保存到这里,然后用浏览器重定向这个文件实现下载

'*********************************

Dim fso, tempfile
Set fso = CreateObject("Scripting.FileSystemObject")
Dim tfolder, tname, tfile

i=Request.QueryString("msgid")
strserver=session("strserver")
strAccount=session("straccount")
strPassword=session("strpassword")
Set POP3 = CreateObject("EasyMail.POP3.5")
POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"
POP3.MailServer = strserver
POP3.Account = straccount
POP3.Password = strpassword
pop3.PreferredBodyFormat=1
pop3.TimeOut=300
x = POP3.Connect
If x <> 0 Then
Response.Write "<p align=center>连接错误: " + CStr(x) + "<br><br>请和管理员联系"
POP3.Disconnect
Response.End
End If

x = POP3.DownloadMessages(0)
If x <> 0 Then
Response.Write "下载错误: " + CStr(x) +"<br><br>请和管理员联系"
POP3.Disconnect
Response.End
End If

pop3.TempDirectory="e:\webmail\mailatt\" '定义一个存放附件临时文件的绝对路径,这个目录必须WEB共享
pp="e:\webmail\mailatt\"
j=(request.querystring("attid")) '得到邮件ID
fn="e:webmail\mailatt\" + pop3.messages.item(i).Attachments.item(j).200417113502.htm
aa=pop3.messages.item(i).Attachments.item(j).save(fn,1) '保存附件到指定目录
path="http://www.mydomain.com/webmail/mailatt/"+pop3.messages.item(i).Attachments.item(j).200417113502.htm '重定向到这个附件文件
Response.Redirect path

相关文章: