用EasyMailObject组件处理Exchange邮件源代码(3)
程序员文章站
2023-08-29 17:25:40
在asp中用easymailobject处理exchange邮件源代码---保存附件(saveatt.)<%@ language=vbscript %><%************...
在asp中用easymailobject处理exchange邮件源代码---保存附件(saveatt.)
<%@ language=vbscript %>
<%
*************************************
这个文件用来下载附件
作者:awayeah
邮箱:awayeah@163.net
*************************************
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:webmailmailatt"
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/wwwrootmailatt"+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
%>
<%@ language=vbscript %>
<%
*************************************
这个文件用来下载附件
作者:awayeah
邮箱:awayeah@163.net
*************************************
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:webmailmailatt"
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/wwwrootmailatt"+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
%>
上一篇: 排骨玉米汤的做法,不走寻常路的新做法
下一篇: 你想减肥吗
推荐阅读
-
用EasyMailObject组件处理Exchange邮件源代码(5)
-
用EasyMailObject组件处理Exchange邮件源代码(6)
-
用EasyMailObject组件处理Exchange邮件源代码(4)
-
用EasyMailObject组件处理Exchange邮件源代码(7)
-
用EasyMailObject组件处理Exchange邮件源代码(1)
-
用EasyMailObject组件处理Exchange邮件源代码(3)
-
在ASP中用EasyMailObject组件处理Exchange邮件源代码(1)
-
在ASP中用EasyMailObject组件处理Exchange邮件源代码(2)
-
用EasyMailObject组件处理Exchange邮件源代码(3)
-
用EasyMailObject组件处理Exchange邮件源代码(1)