Service conversions

The MTA&#x27;s conversion service facility may be used to process, with site-supplied procedures, message content so as to produce a new form  of the message. Unlike either the sorts of    operations discussed elsewhere or the    channel,  which operate on  the content of individual MIME message parts, conversion services  operate on entire MIME entities (MIME headers plus content). (But note that service conversions do not give access to the outermost, non-MIME  header lines.) Also, unlike other   operations or    channel operations, conversion services are expected to do  their own MIME disassembly, decoding, re-encoding, and reassembly.

Service conversions may be triggered using the   channel option. But more typically, like other  operations, conversion services are  enabled through the   mapping table. If the first probe of the   mapping table yields a "Yes"  or "Always" keyword, then the MTA will check for the presence  of conversions options (in Unified Configuration) or the MTA conversions file (in legacy configuration).6  If a conversions file exists,  then the MTA will look in it for an entry specifying a    or , 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 or in-chan=channel-pattern; in-type=type-pattern; in-subtype=subtype-pattern; service-call=image&#x7c;routine&#x7c;argument Of key interest is (in  entries) the    string. This is the command which should be executed to perform a service conversion (e.g., 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. 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 CHARSET-CONVERSION IN-CHAN=bsout_&#x2a;;OUT-CHAN=&#x2a;;CONVERT    Yes and a conversions file entry of in-chan=bsout_&#x2a;; in-type=&#x2a;; in-subtype=&#x2a;; 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 (UNIX) are used to pass the names of the input and output files as well as the name of a file containing some message  envelope information. The names of these environment variables are:

The INFO_FILE in particular contains the envelope From address, the list of the message&#x27;s envelope recipient addresses, and (as of  Chipotle) if present in the original message envelope the authenticated  sender; this information is recorded in the form of pseudo-header  lines, e.g., X-Author-info: authenticated-sender X-Envelope-from: envelope-from X-Envelope-to: recipient-list The values of these three environment variables, INPUT_FILE, OUTPUT_FILE, and INFO_FILE, may be substituted into the command line by  using standard command line substitution: i.e., preceding the  variable&#x27;s name with a dollar character on UNIX. For example, when INPUT_FILE and OUTPUT_FILE have the values   and  , then the following entry on UNIX in-chan=bsout_&#x2a;; in-type=&#x2a;; in-subtype=&#x2a;; service-command="/pmdf/bin/convert.sh $INPUT_FILE $OUTPUT_FILE" executes the command /pmdf/bin/convert.sh a.in a.out Note: Prior to Messaging Server 7.0, the conversions file was located via the IMTA_CONVERSION_FILE MTA Tailor file option,  so usually. As of Messaging Server 7.0, the conversions file is located at.

See also:
 * Character set conversion and message reformatting
 * CHARSET-CONVERSION mapping table
 * Conversion channel
 * BSMTP service conversions
 * serviceconversion Option