Distinct offers Network Monitor, the ONLY natural language Protocol Analyzer, ONC RPC for C++, .NET and Java, and IntelliTerm, the fastest Terminal Emulator for TN3270, TN5250 and VT420 on the market.

Distinct VIT: IMAP Control: OnBodyAttributes

   Products   Downloads   Sales   Support   About us
  VIT
 



        
 

Summary

Used to set the section attributes to be fetched. You can use it to find out specific information about a section of the message.

Description

The OnBodyAttributes event is used when the application wants to fetch the message data on a section of the message. This event will only occur if the application calls the Fetch or UidFetch method with the DataItem parameter containing the IMAP_BODY or IMAP_BODY_PEEK flags

This event can be used to fetch the specified parts of a multipart message, specified fields of an encapsulated header, particular octets of a message or just the text from a message. and various combinations of other attributes. This can be done by setting various body properties: BodyFlags, BodyHeaderField, BodyStartOctet, BodyNumOctets and BodyPart.

The IMAP ActiveX control will keep firing this event to get body attributes to fetch until the BodyFlag property is set to 0 to indicate that all the attributes have been set.

The BodyFlags property must contain one of the following values.

IMAP_ENTIRE_MESSAGE Gets the entire message
IMAP_HEADER Gets the main header
IMAP_HEADER_FIELDS Gets only specific header fields
IMAP_HEADER_FIELDS_NOT Gets all the header fields except the specified ones
IMAP_TEXT Gets the text portion of the message
IMAP_MIME_PART_HEADER Gets the header of a MIME subpart
IMAP_MIME_PART_BODY Gets the body of a MIME subpart

To fetch the entire message the BodyFlags property should be set to IMAP_ENTIRE_MESSAGE. This will retrieve the entire message including the header.

To fetch the entire text section of the message the BodyFlags property should be set to IMAP_TEXT.

To retrieve the entire initial header the BodyFlags property should be set to IMAP_HEADER. To retrieve only the specified fields from the initial header the BodyFlags property should be set to IMAP_HEADER_FIELDS or IMAP_HEADER_FIELDS_NOT. In this case the BodyHeaderFields property must contain the name of the header fields that needs to be fetched or not to be fetched. The fields must be space separated, for example if the application wants to fetch only the "from" and the "to" fields then the BodyHeaderFields property should contain "from to".

Note that IMAP_HEADER, IMAP_HEADER_FIELDS_NOT, IMAP_HEADER_FIELDS should be used only to fetch the fields of the initial header or the encapsulated header of a message of type message/rfc822. To get any portion of a multipart MIME message the application must use IMAP_MIME_PART_HEADER or IMAP_MIME_PART_BODY.

To get the header or the body of a specified part of a multipart message this 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.

If the BodyFlags property has the value IMAP_ENTIRE_MESSAGE, IMAP_HEADER, IMAP_HEADER_FIELDS, IMAP_HEADER_FIELDS_NOT, IMAP_TEXT or IMAP_MIME_BODY_PART then the Distinct IMAP ActiveX control will fire the OnData event to deliver the data to the application. In case of IMAP_MIME_PART_HEADER the Distinct IMAP ActiveX control will parse the header and will deliver the data in the OnMimeHeader event.

The BodyPart property specifies the message section number that needs to be fetched. The application must specify a section 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. Usually the Part will not be used if the BodyFlags is IMAP_HEADER, IMAP_HEADER_FIELDS, IMAP_HEADER_FIELDS_NOT or IMAP_TEXT unless the application is trying to fetch the encapsulated header of the message/rfc822. The BodyPart property is important when the BodyFlags property is either IMAP_MIME_PART_HEADER or IMAP_MIME_PART_BODY.

When fetching message data the application may fetch a portion of a specific section, in that case the BodyStartOctet and BodyNumOctets properties are used to specify the octet position of the first and last octets to retrieve.

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 (not AttrDone) Then

Imap.BodyFlags = IMAP_HEADER_FIELDS

Imap.BodyHeaderFields = "From Subject"

Imap.BodyPart = ""

Imap.BodyStartOctet = -1

Imap.BodyNumOctets = -1

AttrDone = True

Else

Imap.BodyFlags= 0

End If

End Sub



Browse FAQ

Related Products
Mail Objects

Recommended Add-On
Network Monitor,
Protocol Analyzer


Raves
"The night before I went on summer holiday we had to make some 'last minute' configuration changes to approx. 300 routers, a tedious job to do manually with telnet. We went along with MS Excel containing a list of IP-adresses to the routers, and the VIT telnet-component. One hour later the VBA-application (small is beautiful) was working, and after another hour all of our routers were updated with the new configuration. I just say a big "Thanks" to you all for a good sleep that night."
Eirik Brendholen, Ergo Integration AS

"We conducted a test session to compare the performance of similar products, and Distinct's product was better!" [more]
Dr. Shyam Sunder, Carnegie Mellon University

"Together with Distinct, we were able to offer our users an ideal soution to enabling them to connect to Yahoo! Pager, and to do so both quickly and reliably." [more]
Brian Park,
Producer of Yahoo! Pager, Yahoo! Inc.


  10/14/2008   Legal notices | PRIVACY Policy | Networking News |