Processing Exchange Message source code using the Easymailobject component in ASP (3)

Source: Internet
Author: User
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
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.