|
Summary
Receive the contents or filename of the extracted message body and any attachments as
binary.
Description
The OnRecvBodyB event occurs, only if the UseVariant property is set to True, in
response to calling the ExtractMessageEnd method. If the UseVariant property is False then
the OnRecvBody event will occur instead.
This event will occur during the extract message process to deliver the contents or
filename of the message. It will also occur to deliver the file content or filename of any
attachments the message may have.
The MIME ActiveX control will first extract the message header and body. The Mime
ActiveX control fire the OnRecvHeader event to set the message properties, and deliver the
entire message header. The body will be saved to the Destination directory (set in the
call to the ExtractMessageStart) and the OnRecvBodyB event will be fired. In the
OnRecvBodyB event the application should call the RecvBodyB method to get the name of the
extracted file. If the Destination was set to NULL the MIME ActiveX control will fire the
OnRecvBodyB event to deliver, the content of the body can then be retrieved by calling the
RecvBodyB method.
The OnRecvBodyB event will be fired one or more times, usually after each OnRecvHeader
event, to notify the application that is should call RecvBodyB to retrieve the contents or
filename of the message body. The application will be notified of any extracted
attachments in the same way.
The Bytes parameter will contain the length of the data to be retrieved, and the
IsFile parameter specifies whether the data to be received is the filename or the
contents of the file. If IsFile is 0 then the actual content of the message or
attachment will be retrieved by calling the RecvBodyB method; otherwise if IsFile
is 1 the name of the file that contains the message or attachment will be retrieved by the
RecvBodyB method.
To abort the extract message, set the Action property to ACTION_ABORT (or call the
Abort method) during this event. The action in progress will be canceled and no further
such events will occur.
Technical Note
If the message to be extracted is of type multipart or
"message/external-body" the sequence of the OnRecvHeader and OnRecvBodyB events
may differ. In case of multipart messages a OnRecvHeader event can be followed by another
OnRecvHeader event instead of a OnRecvBodyB event. After MIME ActiveX control fires the
OnRecvHeader event with the initial header , the sequence will be OnRecvHeader event
followed by an OnRecvBodyB 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 OnRecvBodyB event.
Note that the general sequence of upcalls will be OnRecvHeader event followed by an
OnRecvBodyB 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 OnRecvBodyB
event may be followed by another OnRecvBodyB event. It is the application's responsibility
to keep track of, and decide how to treat the data received in each OnRecvBodyB event. The
application can so this by checking the ContentType and Subtype properties in each
OnRecvHeader event.
If the message is a non-MIME message then the attachments will be extracted and the
MIME ActiveX control will fire the OnRecvHeader event followed by the OnRecvBodyB event.
Note that for non-MIME messages only the Encoding and the Filename properties will
be set by the OnRecvHeader event.
Example
' HeaderInfo is a structure for the attachment name, encoding used and the
content type
' see the MIME sample for the definition
Sub Mime_OnRecvBodyB (Bytes As Long, IsFile As Integer)
Result = RecvBodyB (Buffer, BufferLength) ' message body
End Sub
|