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: MIME Control: OnRecvHeader

   Products   Downloads   Sales   Support   About us
  VIT
 



        
 

Summary

Receive information about extracted message.

Description

The OnRecvHeader event occurs after calling the ExtractMessageEnd method. This event will occur during the extract message process to deliver information about the message and any attachments the message may have.

The MIME ActiveX control will first extract the message header and body. The Mime ActiveX control will fire the OnRecvHeader event, to notify the application that it has set the message properties, and to deliver the entire message header. The body will be saved to the Destination directory (set in the call to the ExtractMessageStart method) and the OnRecvBody event will be fired to deliver the file name. If the Destination was set to NULL the MIME ActiveX control will deliver the message by firing the OnRecvBody event one or more times, after each OnRecvHeader event, to deliver the contents of the message body. Extracted attachments will be delivered to the application in the same way.

The OnRecvHeader notifies the application that the MIME ActiveX control has set the FileName, Encoding, ContentType, Subtype, MultipartStart, MultipartType, ContentId, ContentBase, ContentLocation, FileSize, Charset, BinHexType, BinHexCreator and BinHexFlag properties. The FileName property will contain the name of the file containing the extracted information, or if no Destination was given it will contain either the name of the attachment file if present in the header or else it will be empty. The other properties will contain the appropriate information or will be empty if they are not relevant to the message. The value of these properties will change with each occurrence of the OnRecvHeader event.

The OnRecvHeader event also delivers the entire header information to the application in the Buffer parameter. The length of the Buffer is specified in the Length parameter. This allows the application to parse the header for any additional information the application may have included when creating the message (By setting the Info parameter in the OnSetHeader event).

For a partial message, the OnRecvHeader event will only be fired when all the parts have been extracted and reassembled to form the original file. Otherwise an OnError event will occur to indicate that only a partial message was extracted.

Note: In all cases the OnRecvBodyB event will occur instead of the OnRecvBody event if the UseVariant property is set to True.

Technical Note

If the message to be extracted is of type multipart or "message/external-body" the sequence of the OnRecvHeader and OnRecvBody events may differ. In case of multipart messages an OnRecvHeader event can be followed by another OnRecvHeader event instead of an OnRecvBody event. After MIME ActiveX control fires the OnRecvHeader event with the initial header , the sequence will be OnRecvHeader event followed by an OnRecvBody event unless there is a part with no body or if there is a nested multipart in which case an OnRecvHeader event may be followed by another OnRecvHeader event. The first body part is usually treated as the message body. The extraction of the rest of the body parts will follow same sequence. The MIME ActiveX control will automatically decode any encoded body part.

Similarly if the message is of type message/external-body then the initial OnRecvHeader event will be followed by an OnRecvHeader event instead of an OnRecvBody event.

Note that the general sequence of upcalls will be OnRecvHeader event followed by an OnRecvBody event unless there is a part with no header or an empty body, in those special cases a OnRecvHeader event may be followed by another OnRecvHeader event or a OnRecvBody event may be followed by another OnRecvBody event. It is the application's responsibility to keep track of, and decide how to treat the data received in each OnRecvBody event. The application can so this by checking the ContentType and Subtype properties after each OnRecvHeader event.

If the message is a non-MIME message then only the Encoding and the Filename properties will be set by the OnRecvHeader event.

Example

Sub Mime_OnRecvHeader (Buffer As String, Length As Integer)
' display
Message = "Extracted...." + Chr(10) + Chr(10)

' filename
Message = Message & "FileName: " & Mime.FileName & Chr(10)

' encoding type
Message = Message & "Encoding: " & Mime.Encoding & Chr(10)

' content type
Message = Message & "ContentType: " & Mime.ContentType & Chr(10)

' subtype
Message = Message & "SubType: " & Mime.Subtype & Chr(10)

' display message
MsgBox Message, 64, "Sample Program"
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/13/2008   Legal notices | PRIVACY Policy | Networking News |