Remove Method


Removes the attachment with the specified index from the collection.

This method can be used, for example, to remove attachments from the existing message.


blnResult = ObjectName.Remove(Index)  
Parameters:  
Index As Long Index of the attachment to be removed. Allowed range is: 1 <= Index <= Attachments.Count
 
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
      If Msg.Attachments.Count > 0 Then
        ' Remove first attachment from the message
        Msg.Attachments.Remove 1
      End If
    End If
  End If
  Mailer.Disconnect
End If

See Also:

RemoveAll Method


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