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

The Output Destination

When an optional output destination is supplied to mtaDecodeMessage(), the processed input message is subsequently written to the output destination. When conversion to MIME is requested, the output message will be the result of the conversion. Additionally, the written message will reflect any changes made by the inspection routine with mtaDecodeMessagePartDelete(). That routine may be used to delete an atomic part or replace the part with new, caller-supplied content.

The output destination can be either a message submission to the MTA (that is, an ongoing enqueue) or an arbitrary destination represented by a caller-supplied output routine.

Enqueue Context

When using a message enqueue context, you must do the following:

  1. Supply the enqueue context along with the MTA_DECODE_NQ item code.

  2. Specification of the message’s recipient list must have already been completed with mtaEnqueueTo() before calling mtaDecodeMessage().

  3. mtaEnqueueFinish() must not yet have been called for the enqueue context.

After the call to mtaDecodeMessage() has completed successfully, complete the message enqueue with mtaEnqueueFinish(). In the event of an error, the message submission should be cancelled with mtaEnqueueFinish(). mtaDecodeMessage() writes the entire message header and content. There is no need for the caller to write anything to the message’s header or content.

Caller-Supplied Output Routine

To use a caller-supplied output routine (for example, decode_write()), supply the address of the output routine along with the MTA_DECODE_PROC item code to mtaDecodeMessage().

Each line passed to the output routine represents a complete line of the message to be output. The output routine must add to the line any line terminators required by the output destination (for example, carriage return, line feed pairs if transmitting over the SMTP protocol, line feed terminators if writing to a UNIX® text file, and so forth).