当前位置: 首页 > 图文教程 > 网络编程 > ASP > 在ASP中用EasyMailObject组件处理Exchange邮件源代码(3)

ASP
ASP制作迅雷看看电影人气指数
Request.ServerVariables参数
rs.open和conn.execute
Rs.Open参数
什么是会话ID和如何使用会话ID
Service Unavailable问题
一些关于购物车的想法
几种常见的保护数据库的方法
验证码不正确,该如何解决?
ASP教程:过滤HTML代码并截取
IIS7中HTTP 500错误
学习ASP基础教程
ASP教程:ASP基础语法
学习ASP获取HTML表单提交信息的实例
301重定向全面认识
介绍一些常见的ASP平台的CMS
正则表达式简单学习
ASP教程:server.transfer方法实例
ASP实例教程代码实现禁止外部提交数据
ASP简单入门教程(1):认识ASP

在ASP中用EasyMailObject组件处理Exchange邮件源代码(3)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 58 ::
收藏到网摘: n/a

保存附件(saveatt.asp)
<%@ Language=VBScript %>
<%
'*************************************

'这个文件用来下载附件
'作者:awayeah
'邮箱:[email protected]

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


Dim fso, tempfile
Set fso = CreateObject("Scripting.FileSystemObject")
Dim tfolder, tname, tfile
' Const TemporaryFolder = 2
' Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
set POP3=session("pop3")

' Set POP3 = CreateObject("EasyMail.POP3.5")
' POP3.LicenseKey = "awa/S19I500R1AX30C0R3100"
' POP3.MailServer = strServer
' POP3.Account = session("straccount")
' POP3.Password = session("strpassword")
' pop3.PreferredBodyFormat=1
' pop3.TimeOut=90
x = POP3.Connect()
If x <> 0 Then
Response.Write "连接错误: " + CStr(x)
POP3.Disconnect
End If

'设定附件存放的临时目录,要用绝对路径,这个目录应赋足够的权限给IUSR_HOST帐户,并且已经WEB共享
pop3.TempDirectory="e:\webmail\mailatt"
y = POP3.DownloadHeaders
i=clng(request.querystring("msgid"))
j=clng(request.querystring("attid"))
msg = POP3.DownloadSingleMessage(i)
'Set Message Object to point to that downloaded message
Set Message = POP3.Messages(msg)
'Message.Attachments(j).save tfolder+"/"+Message.Attachments(j).filename,1
'Message.Attachments(j).save "c:\inetpub/\wwwroot\mailatt\"+Message.Attachments(j).filename,1
'Response.write "file:///"+"/mailatt/"+Message.Attachments(j).filename
pathname=Message.Attachments(j).TempFileName
parentfolder=fso.GetParentFolderName(pathname)
set folder=fso.GetFolder(parentfolder)
dir_name=folder.name
filename=fso.GetFileName(pathname)
path="/webmail/mailatt/"+dir_name+"/"+filename
Response.Redirect path
%>