The MTA’s conversion service facility may be used to process with site-supplied procedures a message so as to produce a new form of the message. Unlike either the sorts of CHARSET-CONVERSION operations discussed above or the conversion channel, which operate on the content of individual MIME message parts, conversion services operate on entire MIME message parts (MIME headers and content) as well as entire MIME messages. Also, unlike other CHARSET-CONVERSION operations or conversion channel operations, conversion services are expected to do their own MIME disassembly, decoding, re-encoding, and reassembly.
Like other CHARSET-CONVERSION operations, conversion services are enabled through the CHARSET-CONVERSION mapping table. If the first probe of the CHARSET-CONVESION mapping table yields a Yes or Always keyword, then the MTA will check for the presence of an MTA conversions file. If a conversions file exists, then the MTA will look in it for an entry specifying a SERVICE-COMMAND, and if it finds such an entry, execute it. The conversions file entries should have the form:
in-chan=channel-pattern; in-type=type-pattern; in-subtype=subtype-pattern; service-command=command
Of key interest is the command string. This is the command that should be executed to perform a service conversion (for example, invoke a document converter). The command must process an input file containing the message text to be serviced and produce as output a file containing the new message text. On UNIX, the command must exit with a 0 if successful and a non-zero value otherwise.
For instance, the combination of a CHARSET-CONVERSION table such as
and an MTA conversions file entry on UNIX of
in-chan=bsout_*; in-type=*; in-subtype=*; service-command="/pmdf/bin/compress.sh compress $INPUT_FILE $OUTPUT_FILE"
will result in all messages coming from a BSOUT channel being compressed.
Environment variables are used to pass the names of the input and output files as well as the name of a file containing the list of the message's envelope recipient addresses. The names of these environment variables are:
INPUT_FILE - Name of the input file to process
OUTPUT_FILE - Name of the output file to produce
INFO_FILE - Name of the file containing envelope recipient addresses
The values of these three environment variables may be substituted into the command line by using standard command line substitution: that is, preceding the variable's name with a dollar character on UNIX. For example, when INPUT_FILE and OUTPUT_FILE have the values a.in and a.out, then the following declaration on UNIX:
in-chan=bsout_*; in-type=*; in-subtype=*; service-command="/pmdf/bin/convert.sh $INPUT_FILE $OUTPUT_FILE"
executes the command
/pmdf/bin/convert.sh a.in a.out