MessageSet Property


The sequence of ordinal message numbers or UIDs to be processed.

By default, all methods of this class which deal with messages, headers or envelopes take "First:Last" ranges as input parameters (RetrieveEnvelopes method is a typical example). However, you can set First parameter to -1 to let the method know that you want to process an arbitrary set of messages (IMAP4 protocol allows this). In this case, you specify the message set via this property.

Message set is a comma-separated list of message numbers or UIDs. Ranges are also allowed. Some valid examples: 568, 1-100, 5,6,8, 2-5,7,14,21-35,39. This property does not control if the values are message numbers or UIDs. You should specify this in AsUID parameter of the method for which you set this property (see the sample code below).


Value Type: String
Parameters: None 

Usage example:

Dim Mailer
'This sample shows Subjects of all unread emails, also doing some error checking
'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.LicenseKey = "put your license key here"
Mailer.ServerName = "mailserver.com"
Mailer.UserName = "MyName"
Mailer.Password = "MyPassword"
If Mailer.Connect Then
  If Mailer.SelectMailbox("Inbox") Then
    arrUIDs = Mailer.Search(True, "UNSEEN")
    Mailer.MessageSet = Join(arrUIDS, ",")
    If Mailer.MessageSet = "" Then
      MsgBox "No unread messages"
    Else
      Set Envelopes = Mailer.RetrieveEnvelopes(-1, -1, True)
      If Not Envelopes Is Nothing Then
        For Each Envelope In Envelopes
          MsgBox Envelope.Subject
        Next
      Else
        MsgBox "Error #" & CStr(Mailer.ErrCode)
        If Mailer.ErrCode = 311 Or Mailer.ErrCode = 312 Then
          MsgBox Mailer.ServerStatusResponse
        End If
      End If
    End If
  End If
  Mailer.Disconnect
Else
  MsgBox Mailer.ErrDesc
End If

See Also:

CopyMessages Method
DeleteMessages Method
MoveMessages Method
RetrieveEnvelopes Method
RetrieveEnvelopesEx Method
RetrieveMessagesSize Method
SetFlagsForMessage Method
SetFlagsForMessageAsString Method


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