SaveFile Method


Writes content of the attachment (value of Content property) to disk.


blnResult = ObjectName.SaveFile(DirPath, [Filename])  
Parameters:  
DirPath As String Path to the directory where to store attached file  
Filename As String (optional) The attachment will be saved to disk under this name. If this parameter is omitted, Attachment.Filename property will be used as filename  
Return value As Boolean True if successful, False if error has occurred  

Usage example:

Dim Mailer, Msg, Attach
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
  If Mailer.MessageCount > 0 Then
    Set Msg = Mailer.RetrieveSingleMessage(1)
    If Not Msg Is Nothing Then
      For Each Attach In Msg.Attachments
        If Not Attach.SaveFile ("C:\Data Files") Then MsgBox "I/O Error"
      Next
    End If
  End If
  Mailer.Disconnect
End If

See Also:

Attachment Object
IsInline Property
Content Property


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.