Flags Property


Contains the flags set for the message.

This can be zero, or any combination of the following values:

To search mailbox for messages with specific flag set, use Search method of IMAP4 object.

To examine non-standard flags, use FlagsAsString property.


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

Usage example:

' This sample displays all flags for the last message in Inbox
Dim Mailer, Envelopes, Envelope, Flags
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.IMAP4")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.IMAP4")
'In ASP use Response.Write instead of MsgBox
Mailer.EnableLogging = True
Mailer.LogFilePath = "C:\Temp\imap4_log.txt"
Mailer.ClearLog
Mailer.LicenseKey = "put your license key here"
If Mailer.Connect("mailserver.com", 143, "MyName", "MyPassword") Then
  If Mailer.SelectMailbox("Inbox") Then
    Set Envelopes = Mailer.RetrieveEnvelopes(Mailer.MessageCount, Mailer.MessageCount, False)
    If Not Envelopes Is Nothing Then
      For Each Envelope In Envelopes
        Flags = Envelope.Flags
        If (Flags And 1) = 1 Then MsgBox "Answered"
        If (Flags And 2) = 2 Then MsgBox "Deleted"
        If (Flags And 4) = 4 Then MsgBox "Draft"
        If (Flags And 8) = 8 Then MsgBox "Flagged"
        If (Flags And 16) = 16 Then MsgBox "Recent"
        If (Flags And 32) = 32 Then MsgBox "Seen"
      Next
    End If
  End If
  Mailer.Disconnect
End If

See Also:

IMAP4.Search Method


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