Envelopes Collection

The Envelopes collection contains Envelope objects used to examine properties of messages on the IMAP4 server.

To obtain the Envelopes collection, either call RetrieveEnvelopes or RetrieveEnvelopesEx method of the IMAP4 object.




Count Returns the number of Envelope objects in the collection.
Item Returns a reference to Envelope object in the collection.



Item is the default property of the collection, so Envelopes.Item(index) and Envelopes(index) are equivalents.

To iterate through the collection, you can use either For .. Each statement or any common loop statement such as For .. To.



The following examples use different syntax to display "Subject:" field of all messages in the IMAP4 folder. It's assumed the Envelopes collection has been already obtained with RetrieveEnvelopes method call and stored in objEnvelopes variable.

For .. Each syntax
For Each objEnvelope In objEnvelopes
  MsgBox objEnvelope.Subject
  ' In ASP, use Response.Write instead of MsgBox


For .. To syntax
For I = 1 To objEnvelopes.Count
  MsgBox objEnvelopes(I).Subject
  ' In ASP, use Response.Write instead of MsgBox


See Also

Envelope Object, IMAP4 Object, IMAP4.RetrieveEnvelopes Method


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