HasAttachments Property


True if the message has attachments.

This property can be determined from the message headers, so it is set even if only headers are available (RetrieveSingleMessageHeaders or RetrieveHeaders method was used).

Note: Some odd messages may have incorrect Content-Type header setting, so HasAttachments property should be used with care, for preview purposes only. The only 100%-reliable way to determine whether attachments are present or not is to receive the message completely (using RetrieveSingleMessage or RetrieveMessages method). If the message is received completely, HasAttachments is determined from the size of Attachments collection (so it will be correct in 100% cases).


Value Type: Boolean
Parameters: None 
Remarks: This property is read-only

Usage example:

Dim Mailer, Msg
'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.HasAttachments Then
          MsgBox "It seems the message has attachments"
        Else
          MsgBox "The message does not seem to have attachments"
        End If
      End If
   End If
   Mailer.Disconnect
End If

See Also:

Message Object
Attachments.Count Property
POP3.RetrieveSingleMessage Method
POP3.RetrieveSingleMessageHeaders Method
POP3.RetrieveMessages Method
POP3.RetrieveHeaders Method


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