Search The ForumSearch   RegisterRegister  LoginLogin

MailBee POP3

 AfterLogic Forum : MailBee POP3
Subject Topic: Download attachment files Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Miquel rodnie
Newbie
Newbie


Joined: 07 September 2008
Online Status: Offline
Posts: 2
Posted: 07 September 2008 at 11:45pm | IP Logged Quote Miquel rodnie

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 View Miquel rodnie's Profile Search for other posts by Miquel rodnie
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 08 September 2008 at 3:10am | IP Logged Quote Andrew

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 View Andrew's Profile Search for other posts by Andrew
 
Miquel rodnie
Newbie
Newbie


Joined: 07 September 2008
Online Status: Offline
Posts: 2
Posted: 08 September 2008 at 8:12am | IP Logged Quote Miquel rodnie

Now it works,
thanks for the quick answer
Miquel
Back to Top View Miquel rodnie's Profile Search for other posts by Miquel rodnie
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide