| Author |  | 
      
        | Guests Guest Group
 
  
 
 Joined: 10 November 2003
 Online Status: Online
 Posts: 262
 | 
          Hi,
           | Posted: 07 June 2004 at 7:06am | IP Logged |   |  
           | 
 |  
 Is it anyway possible to download attachment to the server where webmail/pop3 is installed without user interaction? I am using the POP3 object to move messages from a mailserver to a local SQL database and then deleting the messages on the mailserver when moved.
 
 Thanks for a great product.
 
 / Kim
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Assuming you have downloaded a message and want to save its attachments to disk on the server, you can use SaveFile method of Attachment object:
           | Posted: 07 June 2004 at 7:48am | IP Logged |   |  
           | 
 |  
 ...
 Set Msg = Mailer.RetrieveSingleMessage(1)
 
 For Each Attach In Msg.Attachments
 Attach.SaveFile "C:\Attachments"
 Next
 
 If you want to save attachments under unique names (e.g. you store all messages attachments in the same directory) you can use FileSystemObject.GetTempName method to get unique filename:
 
 ...
 Set fso = Server.CreateObject("Scripting.FileSystemObject")
 Set Msg = Mailer.RetrieveSingleMessage(1)
 
 For Each Attach In Msg.Attachments
 strUnique = fso.GetTempName
 Attach.SaveFile "C:\Attachments", strUnique
 Next
 
 You can obtain more information and samples in MailBee Objects documentation which is installed as a part of WebMail Pro product.
 
 | 
       
        | Back to Top |     | 
       
       
        |  |