|
Summary
Specifies the part of a multipart MIME message to be retrieved.
Description
When fetching message data the application may want to retrieve one or more sections of the message. This property is used to specify which section.
If used, this property must be set in the OnBodyAttributes event that occurs in response to calling the Fetch or UidFetch method with the DataItems parameter containing IMAP_BODY OR IMAP_BODY_PEEK.
The BodyPart property should be set to the message part to retrieve data for.
To get the header or the body of a specified part of a multipart message the BodyFlags property should be set to IMAP_MIME_PART_HEADER or IMAP_MIME_PART_BODY respectively. The BodyPart property
should be set to the part of the message to retrieve.
The BodyPart property specifies the body part number that needs to be fetched. The application must specify a part only if it is trying to fetch a part of a multipart message or a message of type
message/rfc822. In all the other cases the BodyPart should be set to an empty string. If the BodyFlags property is IMAP_HEADER, IMAP_HEADER_FIELDS, IMAP_HEADER_FIELDS_NOT or IMAP_TEXT then the
BodyPart property is usually not used unless the application is trying to fetch the encapsulated header of message/rfc822. The BodyPart property is important when the BodyFlags property is either
IMAP_MIME_PART_HEADER or IMAP_MIME_PART_BODY.
If used this property should be set at run time in the OnBodyAttributes event. There is no default value for this property.
Example
Private Sub Imap_OnBodyAttributes()
'Set the body attributes to fetch
'In response to Fetch with IMAP_BODY OR IMAP_BODY_PEEK as a DataItem
If (Part = 1) Then
Imap.BodyFlags = IMAP_MIME_PART_BODY
Imap.BodyPart = "1" ' first part
Part = Part + 1
ElseIf (Part = 2) Then
Imap.BodyFlags = IMAP_MIME_PART_BODY
Imap.BodyPart = "2" ' second part
Part = 0 ' reset
Else
Imap.BodyFlags= 0 ' done
End If
End Sub
See Also
Fetch, UidFetch methods; OnBodyAttributes event; Body Flags property
|