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.
Syntax
Envelopes.property
Properties | |
Count | Returns the number of Envelope objects in the collection. |
Item | Returns a reference to Envelope object in the collection. |
Remarks
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.
Example
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 objEnvelope In objEnvelopes
MsgBox objEnvelope.Subject
' In ASP, use Response.Write instead of MsgBox
Next
For .. To syntax
For I = 1 To objEnvelopes.Count
MsgBox objEnvelopes(I).Subject
' In ASP, use Response.Write instead of MsgBox
Next
See Also
Envelope Object, IMAP4 Object, IMAP4.RetrieveEnvelopes Method