Object| Source code Save attachment (saveatt.asp)
<%@ Language=vbscript%>
<%
'*************************************
' This file is used to download attachments
' Author: Awayeah
' E-mail: 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 "Connection Error:" + CStr (x)
POP3. Disconnect
End If
' Set the temporary directory of the attachment, to use the absolute path, this directory should give sufficient permissions to the Iusr_host account, and has been web-shared
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 "to" 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
%>