在ASP中用EasyMailObject組件處理Exchange郵件原始碼(3)

來源:互聯網
上載者:User
object|原始碼 儲存附件(saveatt.asp)
<%@ 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:\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
%>



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.