Author |
|
Miquel rodnie Newbie
Joined: 07 September 2008
Online Status: Offline Posts: 2
|
Posted: 07 September 2008 at 11:45pm | IP Logged
|
|
|
I've read many posts about attachment files but I don't get a clear idea.
What I want is to download the files that I receive with the e-mails. This files are pdf, dwg, doc, etc....
With the samples that are included with the pop3 application I only can see the file in the webbrowser. What I want is to save them in my server in a folder. I saw several posts talking about it but I don't got it.
My code is
If oMailer.Connect Then
' Look up Unique-ID from the query string in the array of Unique-ID's, and
' get message number of the message under given Unique-ID
nMessageNumber = oMailer.GetMessageNumberFromUID(Request.QueryString("uid"))
' The message was found in the Unique-ID's array?
If nMessageNumber > 0 Then
' Completely download the message
Set oMsg = oMailer.RetrieveSingleMessage(nMessageNumber)
If Not oMailer.IsError Then
' Get specified attachment
Set oAttach = oMsg.Attachments(Request.QueryString("attach"))
' Set HTTP headers
Response.AddHeader "Content-Disposition", "filename=" & oAttach.Filename
' Send attachment's contents to the client
dim attach
For Each Attach In oMsg.Attachments
Attach.SaveFile("C:\wwwroot\intranet\simple\temp")
response.write(attach.filename)
Next
Else
DisplayError oMailer
End If
Else
Response.Write "<font color=red>Message under specified UID not found</font>"
End If
' The message is retrieved (or error occurred), so we
' may disconnect now
oMailer.Disconnect
Else
DisplayError oMailer
End If
This code only writes the filename in the webbrowser but I don't find the downloaded file.
Anyone can help.
Thanks in advance
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 08 September 2008 at 3:10am | IP Logged
|
|
|
That's because IIS process doesn't have permission to write into C:\wwwroot\intranet\simple\temp folder. Try to assign "Full Control" permission to "Everyone" user over that folder.
Best regards,
Andrew
|
Back to Top |
|
|
Miquel rodnie Newbie
Joined: 07 September 2008
Online Status: Offline Posts: 2
|
Posted: 08 September 2008 at 8:12am | IP Logged
|
|
|
Now it works,
thanks for the quick answer
Miquel
|
Back to Top |
|
|