Use the HeaderFields Object to manage message header fields. This collection is similar to the DartStrings collection, with additional methods for processing header fields.
Header fields may be added individually, or as a block to be automatically unwrapped and parsed through the Add method. This collection also provides an Item method to support access by position, symbolic field name, or matching string.
The Message object implements the To, Cc, and Bcc properties with the DartStrings object. Use those properties for recipient storage instead of the HeaderFields Object.
Private Sub Command1_Click() Dim Hdr As New HeaderFields, Begin As Long Hdr.Add msgFrom, "developer@dart.com" Hdr.Add msgReceived, "from x@y by a@b with z id abc" Hdr.Add msgReceived, "from xx@dart.com by a22 with grasp id 33a1" Hdr.Add msgReceived, "from frd@dart.com by kahuna with z id k32" Hdr.Add msgFrom, "sales@dart.com" Hdr.Add msgSubject, "time marches on" Begin = 0 ' start search at beginning While Hdr.Find(msgReceived, , Begin) <> "" ' find index of next "Received" MsgBox "Found: " & Hdr(Begin) ' use positional lookup Wend MsgBox (Hdr.Find(msgSubject)) ' show the message Subject line End Sub