As described above, the CHARSET-CONVERSION mapping table is also used to effect the conversion of attachments between MIME and several proprietary mail formats.
The following sections give examples of some of the other sorts of message reformatting which can be affected with the CHARSET-CONVERSION mapping table.
Mail in certain non-standard (non-MIME) formats; for example, mail in certain proprietary formats or mail from the Microsoft Mail (MSMAIL) SMTP gateway is automatically converted into MIME format if CHARSET-CONVERSION is enabled for any of the channels involved in handling the message. If you have a tcp_local channel then it is normally the incoming channel for messages from a Microsoft Mail SMTP gateway, and the following will enable the conversion of messages delivered to your local users:
CHARSET-CONVERSION IN-CHAN=tcp_local;OUT-CHAN=ims-ms;CONVERT Yes
You may also wish to add entries for channels to other local mail systems. For instance, an entry for the tcp_internal channel:
CHARSET-CONVERSION IN-CHAN=tcp_local;OUT-CHAN=l;CONVERT Yes IN-CHAN=tcp_local;OUT-CHAN=tcp_internal;CONVERT Yes
Alternatively, to cover every channel you can simply specify OUT-CHAN=* instead of OUT-CHAN=ims-ms. However, this may bring about an increase in message processing overhead as all messages coming in the tcp_local channel will now be scrutinized instead of just those bound to specific channels.
More importantly, such indiscriminate conversions might place your system in the dubious and frowned upon position of converting messages—not necessarily your own site’s—which are merely passing through your system, a situation in which you should merely be acting as a transport and not necessarily altering anything beyond the message envelope and related transport information.
To convert MIME into the format Microsoft Mail SMTP gateway understands, use a separate channel in your MTA configuration for the Microsoft Mail SMTP gateway; for example, tcp_msmail, and put the following in the mappings. file:
CHARSET-CONVERSION IN-CHAN=*;OUT-CHAN=tcp_msmail;CONVERT RFC1154
Some user agents or gateways may emit messages with MIME headers that are less informative than they might be, but that nevertheless contain enough information to construct more precise MIME headers. Although the best solution is to properly configure such user agents or gateways, if they are not under your control, you can instead ask the MTA to try to reconstruct more useful MIME headers.
If the first probe of the CHARSET-CONVERSION mapping table yields a Yes or Always keyword, then the MTA will check for the presence of a conversions file. If a conversions file exists, then the MTA will look in it for an entry with RELABEL=1 and if it finds such an entry, the MTA will then perform any MIME relabelling specified in the entry. See 13.5.3 To Control Conversion Processing for information on conversions file entries.
For example, the combination of a CHARSET-CONVERSION table such as:
CHARSET-CONVERSION IN-CHAN=tcp_local;OUT-CHAN=tcp_internal;CONVERT Yes
and MTA conversion file entries of
out-chan=ims-ms; in-type=application; in-subtype=octet-stream; in-parameter-name-0=name; in-parameter-value-0=*.ps; out-type=application; out-subtype=postscript; parameter-copy-0=*; relabel=1 out-chan=ims-ms; in-type=application; in-subtype=octet-stream; in-parameter-name-0=name; in-parameter-value-0=*.msw; out-type=application; out-subtype=msword; parameter-copy-0=* relabel=1
will result in messages that arrive on the tcp_local channel and are routed to the ims-ms channel, and that arrive originally with MIME labelling of application/octet-stream but have a filename parameter with the extension ps or msw, being relabelled as application/postscript or application/msword, respectively. (Note that this more precise labelling is what the original user agent or gateway should have performed itself.) Such a relabelling can be particularly useful in conjunction with a MIME-CONTENT-TYPES-TO-MR mapping table, used to convert such resulting MIME types back into appropriate MRTYPE tags, which needs precise MIME labelling in order to function optimally; if all content types were left labelled only as application/octet-stream, the MIME-CONTENT-TYPES-TO-MR mapping table could only, at best, unconditionally convert all such to one sort of MRTYPE.
With the above example and MIME-CONTENT-TYPES-TO-MR mapping table entries including
APPLICATION/POSTSCRIPT PS APPLICATION/MSWORD MW
a labelling coming in as, for example,
Content-type: application/octet-stream; name=stuff.ps
would be relabelled as
and then converted into an MRTYPE tag PS to let Message Router know to expect PostScript.
Sometimes it is useful to do relabelling in the opposite sort of direction, “downgrading” specific MIME attachment labelling to application/octet-stream, the label for generic binary data. In particular, “downgrading” specific MIME labelling is often used in conjunction with the convert_octet_stream channel keyword on the mime_to_x400 channel (PMDF-X400) or xapi_local channel (PMDF-MB400) to force all binary MIME attachments to be converted to X.400 bodypart 14 format.
For instance, the combination of a CHARSET-CONVERSION mapping table such as
CHARSET-CONVERSION IN-CHAN=*;OUT-CHAN=mime_to_x400*;CONVERT Yes
and PMDF conversions file entries of
out-chan=mime_to_x400*; in-type=application; in-subtype=*; out-type=application; out-subtype=octet-stream; relabel=1 out-chan=mime_to_x400*; in-type=audio; in-subtype=*; out-type=application; out-subtype=octet-stream; relabel=1 out-chan=mime_to_x400*; in-type=image; in-subtype=*; out-type=application; out-subtype=octet-stream; relabel=1 out-chan=mime_to_x400*; in-type=video; in-subtype=*; out-type=application; out-subtype=octet-stream; relabel=1
will result in downgrading various specific MIME attachment labelling to the generic application/octet-stream labelling (so that convert_octet_stream will apply) for all messages going to mime_to_x400* channels.
Macintosh files have two parts, a resource fork that contains Macintosh specific information, and a data fork that contains data usable on other platforms. This introduces an additional complexity when transporting Macintosh files, as there are four different formats in common use for transporting the Macintosh file parts. Three of the formats, Applesingle, Binhex, and Macbinary, consist of the Macintosh resource fork and Macintosh data fork encoded together in one piece. The fourth format, Appledouble, is a multipart format with the resource fork and data fork in separate parts. Appledouble is hence the format most likely to be useful on non-Macintosh platforms, as in this case the resource fork part may be ignored and the data fork part is available for use by non-Macintosh applications. But the other formats may be useful when sending specifically to Macintoshes.
The MTA can convert between these various Macintosh formats. The CHARSET-CONVERSION keywords Appledouble, Applesingle, Binhex, or Macbinary tell the MTA to convert other MacMIME structured parts to a MIME structure of multipart/appledouble, application/applefile, application/mac-binhex40, or application/macbinary, respectively. Further, the Binhex or Macbinary keywords also request conversion to the specified format of non-MacMIME format parts that do nevertheless contain X-MAC-TYPE and X-MAC-CREATOR parameters on the MIME Content-type: header. The CHARSET-CONVERSION keyword Block tells the MTA to extract just the data fork from MacMIME format parts, discarding the resource fork; (since this loses information, use of Appledouble instead is generally preferable).
For example, the following CHARSET-CONVERSION table would tell the MTA to convert to Appledouble format when delivering to the VMS MAIL mailbox or a GroupWise postoffice, and to convert to Macbinary format when delivering to the Message Router channel:
CHARSET-CONVERSION IN-CHAN=*;OUT-CHAN=l;CONVERT Appledouble IN-CHAN=*;OUT-CHAN=wpo_local;CONVERT Appledouble IN-CHAN=*;OUT-CHAN=tcp_internal;CONVERT Macbinary
The conversion to Appledouble format would only be applied to parts already in one of the MacMIME formats. The conversion to Macbinary format would only be applied to parts already in one of the MacMIME formats, or non-MacMIME parts which included X-MAC-TYPE and X-MAC-CREATOR parameters on the MIME Content-type: header.
When doing conversion to Appledouble or Block format, the MAC-TO-MIME-CONTENT-TYPES mapping table may be used to indicate what specific MIME label to put on the data fork of the Appledouble part, or the Block part, depending on what the Macintosh creator and Macintosh type information in the original Macintosh file were. Probes for this table have the form format|type|creator|filename where format is one of SINGLE, BINHEX or MACBINARY, where type and creator are the Macintosh type and Macintosh creator information in hex, respectively, and where filename is the filename.
For example, to convert to Appledouble when sending to the ims-ms channel and when doing so to use specific MIME labels for any MS Word or PostScript documents converted from MACBINARY or BINHEX parts, appropriate tables might be:
CHARSET-CONVERSION IN-CHAN=*;OUT-CHAN=ims-ms;CONVERT Appledouble MAC-TO-MIME-CONTENT-TYPES ! PostScript MACBINARY|45505346|76677264|* APPLICATION/POSTSCRIPT$Y BINHEX|45505346|76677264|* APPLICATION/POSTSCRIPT$Y ! Microsoft Word MACBINARY|5744424E|4D535744|* APPLICATION/MSWORD$Y BINHEX|5744424E|4D535744|* APPLICATION/MSWORD$Y
Note that the template (right hand side) of the mapping entry must have the $Y flag set in order for the specified labelling to be performed. Sample entries for additional types of attachments may be found in the file mac_mappings.sample in the MTA table directory.
If you wish to convert non-MacMIME format parts to Binhex or Macbinary format, such parts need to have X-MAC-TYPE and X-MAC-CREATOR MIME Content-type: parameter values provided. Note that MIME relabelling can be used to force such parameters onto parts that would not otherwise have them.