Sun Java System Messaging Server 6 2005Q4 MTA Developer's Reference

The Inspection Routine

Whenever mtaDecodeMessage() is called, an “inspection” routine must be supplied by the caller. In Example 5–1, the inspection routine’s name is decode_inspect().

As the message is parsed and decoded, mtaDecodeMessage() presents each atomic message part to the inspection routine one line at a time. The presentation begins with the part’s header lines. Once all of the header lines have been presented, the lines of content are presented.

So that the inspection routine can tell if it is being presented with a line from the header or content of the message, a data type indicator is supplied to the inspection routine each time it is called. In regards to lines of the message’s content, the data type indicator discriminates between text and binary content. Text content is considered any content with a MIME content type of text or message (for example, text/plain, text/html, message/rfc822), while binary content is all other MIME content types (application, image, and audio).

When writing an inspection routine for use with mtaDecodeMessage(), the following points apply: