Previous Contents Index Next |
iPlanet Messaging Server 5.2 Administrator's Guide |
Chapter 9 Using Pre-defined Channels
When you first install iPlanet Messaging Server, several channels are already defined (see Table 9-1). This chapter describes how to use pre-defined channel definitions in the MTA.If you have not already read Chapter 6 "About MTA Services and Configuration," you should do so before reading this chapter. For information about configuring the rewrite rules in the imta.cnf file, see Chapter 7 "Configuring Rewrite Rules."
This chapter contains the following sections:
"To Deliver Messages to Programs Using the Pipe Channel"
"To Configure the Native (/var/mail) Channel"
"To Temporarily Hold Messages Using the Hold Channel"
"Character Set Conversion and Message Reformatting"
Table 9-1    Predefined Channels
Channel
Definition
UNIX only. Used to make routing decisions and for submitting mail using UNIX mail tools.
UNIX only. Delivers mail to /var/mail. (Note that Messaging Server does not support /var/mail access. User must use UNIX tools to access mail from the /var/mail store.)
Used to perform delivery via a site-supplied program or script. Commands executed by the pipe channel are controlled by the administrator via the imsimta program interface. For more information, see "To Deliver Messages to Programs Using the Pipe Channel".
These channels are used for deferred, offline message processing. The reprocess channel is normally invisible as a source or destination channel; the process channel is visible like other MTA channels.
Performs body-part-by-body-part conversions on messages flowing through the MTA.
Used to process messages for users who have been marked as inactive/deleted in the directory. Typically, bounces the message and returns custom bounce message to the sender of the message.
Used to hold messages for users. For example, when a user is migrated from one mail server to another.
Implements SMTP over TCP/IP. The multithreaded TCP SMTP channel includes a multithreaded SMTP server that runs under the control of the Dispatcher. Outgoing SMTP mail is processed by the channel program tcp_smtp_client, and runs as needed under the control of the Job Controller.
tcp_local receives inbound messages from remote SMTP hosts. Depending on whether you use a smarthost/firewall configuration, either sends outbound messages directly to remote SMTP hosts or sends outbound messages to the smarthost/firewall system.
tcp_intranet receives and sends messages within the intranet.
tcp_auth is used as a switch channel for tcp_local; authenticated users switch to the tcp_auth channel to avoid realy-blocking restrictions.
tcp_submit accepts message submissionsusually from user agentson the reserved submission port 587 (see RFC 2476).
tcp_tas is a special channel used by sites doing Unified Messaging.
To Deliver Messages to Programs Using the Pipe Channel
Users might want incoming mail passed to a program instead of to their mailbox. For example, users might want their incoming mail sent to a mail sorting program or to an autoreply agent like Vacation Notice. The pipe channel performs delivery of messages using per-user, site-supplied programs.To facilitate program delivery, you must first register programs as invokable by the pipe channel. You do this by using the imsimta program utility. This utility gives a unique name to each command that you register as invokable by the pipe channel. End users can then specify the program name as a value of their mailprogramdeliveryinfo LDAP attribute.
For example, to add a UNIX command myprocmail as a program that can be invoked by a user, you would first register the command by using the imsimta program utility as shown in the following example. This example registers a program called myprocmail that executes the program procmail with the arguments -d username and executes as the user:
imsimta program -a -m myprocmail -p procmail -g "-d %s" -e user
Make sure the executable exists in the programs directoryserver-instance/imta/programsand that the execute permissions are set to "others."
To enable a user to access the program, the user's LDAP entry must contain the following attributes and values:
maildeliveryoption: program
mailprogramdeliveryinfo: myprocmailFor more information about the imsimta program utility, see the Messaging Server Reference Manual.
Alternative delivery programs must conform to the following exit code and command-line argument restrictions:
Exit Code Restrictions. Delivery programs invoked by the pipe channel must return meaningful error codes so that the channel knows whether to dequeue the message, deliver for later processing, or return the message.
If the subprocess exits with an exit code of 0 (EX_OK), the message is presumed to have been delivered successfully and is removed from the MTA queues. If it exits with an exit code of 71, 74, 75, or 79 (EX_OSERR, EX_IOERR, EX_TEMPFAIL, or EX_DB), a temporary error is presumed to have occurred and delivery of the message is deferred. If any other exit code is returned, then the message will be returned to its originator as undeliverable. These exit codes are defined in the system header file sysexits.h.
Command Line Arguments. Delivery programs can have any number of fixed arguments as well as the variable argument, %s, representing the user name for programs executed by the user or username+domain for programs executed by the postmaster, "inetmail." For example, the following command line delivers a recipient's mail using the program procmail:
To Configure the Native (/var/mail) Channel
An option file may be used to control various characteristics of the native channel. This native channel option file must be stored in the MTA configuration directory and named native_option (for example, server_root/msg-instance/imta/config/native_option).Option files consist of several lines. Each line contains the setting for one option. An option setting has the form:
option=value The value may be either a string or an integer, depending on the option's requirements.
To Temporarily Hold Messages Using the Hold Channel
The hold channel is used to hold the messages of a recipient temporarily prevented from receiving new messages. Messages may be held because a user's name is being changed, or their mailbox is being moved from one mailhost or domain to another. There may also be other reasons to temporarily halt a user from receiving messages, but those are the most common.Messages are placed in the hold channel by setting one of the maildeliveryoption values of a user to hold. All other maildeliveryoption values are ignored (maildeliveryoption is a multi-valued attribute), and messages to the user are routed to the hold channel.
Unlike most channels, the hold channel master program is not configured to run automatically. Messages queued in the hold channel will remain there until the hold_master program is invoked by the administrator.
The Conversion Channel
The conversion channel allows you to perform arbitrary body part-by-body part processing on specified messages flowing through the MTA. (Note that a body part is different than a message in that a message can contain multiple body parts as, for instance, in an attachment.) This processing can be done by any site-supplied programs or command procedures and may do such things such as convert text or images from one format to another, virus scanning, language translation and so forth. Various message types of the MTA traffic are selected for conversion, and specific processes and programs can be specified for each type of message body part.The prerequisite for using this chapter is understanding the concept of channels (see "Channels"). For supplemental information on virus scanning using the conversion channel, refer to the iPlanet Messaging Server Technical Notes at the bottom of the iPlanet Messaging Server Documentation website.
Implementing the conversion channel consists of A) selecting message traffic for processing, and B) specifying how different messages will be processed. These procedures will discussed in further detail.
Note A default conversion channel is automatically created in the MTA configuration file (imta.cnf). This channel can be used as is and requires no modification.
MIME Overview
The conversion channel makes extensive use of the MIME (Multipurpose Internet Mail Extensions) header lines. Knowledge of message construction and MIME header fields is required. For complete information on MIME, refer to RFCs 1806, 2045 through 2049, and 2183. A short overview of MIME is presented here for convenience.
Message Construction
A simple message consists of a header and a body. The header is at the top of the message and contains certain control information such as date, subject, sender, and recipient. The body is everything after the first blank line after the header. MIME specifies a way to construct more complex messages which can contain multiple body parts, and even body parts nested within body parts. Messages like these are called multi-part messages, and, as mentioned earlier, the conversion channel performs body part-by-body part processing of messages.
MIME Headers
The MIME specification defines a set of header lines for body parts. These include MIME-Version, Content-type, Content-Transfer-Encoding, Content-ID, and Content-disposition. The conversion channel uses the Content-type and Content-disposition headers most frequently. An example of some MIME header lines is shown below:
Content-type Header
The MIME Content-Type header describes the content of the body-part. The Content-Type header format (with an example) is shown below:
type describes the type of content of the body part. Examples of type are Text, Multipart, Message, Application, Image, Audio, and Video.
- Content-type: type/subtype; parameter1=value; parameter2=value...
subtype further describes content type. Each Content-type has its own set of subtypes. For examples: text/plain, application/octet-stream, and image/jpeg. Content Subtypes for MIME mail are assigned and listed by the IANA (Internet Assigned Numbers Authority). A copy of the list is at http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
parameter is specific to Content-type/subtype pairs. For example, the charset and the name parameters are shown below:
The charset parameter specifies a character set for a textual message. The name parameter gives a suggested file name to be used if the data were to be written to a file.
- Content-type: text/plain; charset=us-ascii
Content-type: application/msword; name=temp.doc
Note Content-Type values, subtypes, and parameter names are case-insensitive.
Content-disposition Header
The MIME Content-disposition header provides presentation information for the body-part. It is often added to attachments specifying whether the attachment body part should be displayed (inline) or presented as a file name to be copied (attachment). The Content-disposition header has the following format:
disposition_type is usually inline (display the body part) or attachment (present as file to save.) Attachment usually has the parameter filename with a value specifying the suggested name for the saved file.
- Content-disposition: disposition_type; parameter1=value;parameter2=value...
For details on the Content-disposition header, refer to RFC2183.
Selecting Traffic for Conversion Processing
Unlike other MTA channels, the conversion channel is not normally specified in an address or MTA rewrite rule. Instead, messages are sent to the conversion channel using the CONVERSIONS mapping table (specified by the parameter IMTA_MAPPING_FILE in the imta_tailor file). Entries to the table have the following format:
As the MTA processes each message it probes the CONVERSIONS mapping table (if one is present). If the source-channel is the channel from which the message is coming and destination-channel is the channel to which the message is going, then the action following CONVERT is taken (Yes means the MTA diverts the message from its destination-channel to the conversion channel; if no match is found, the message will be queued to the regular destination channel).
- IN-CHAN=source-channel;OUT-CHAN=destination-channel;CONVERT Yes/No
Note An address of the form user@conversion.localhostname or user@conversion will be routed through the conversion channel, regardless of the CONVERSIONS mapping table.
The following example routes all non-internal messagesmessages originating from, or destined to, the Internetto the conversion channel.
CONVERSIONS
IN-CHAN=tcp_local;OUT-CHAN=*;CONVERT Yes
IN-CHAN=*;OUT-CHAN=tcp_local;CONVERT YesThe first line specifies that messages coming from the tcp_local channel will be processed. The second line specifies that messages going to the tcp_local channel will also be processed. The tcp_local channel handles all messages going to and coming from the Internet. Since the default is to not go through the conversion channel, any other messages won't go through the conversion channel.
Note that this is a very basic table, and that it might not be sufficient for a site with a more customized configuration, for example, one using multiple outbound-to-the-Internet tcp_* channels, or using multiple inbound-from-the-Internet tcp_* channels.
To Control Conversion Processing
When a message is sent to the conversion channel, it is processed body part-by-body part. Processing is controlled by the MTA conversions file, which is specified by the IMTA_CONVERSION_FILE option in the imta_tailor file (default: server_root/msg-instance/imta/conversions). The conversions file consists of entries that control which types of body parts will be processed, and how they will be processed.Each entry consists of one or more lines containing one or more name=value parameter clauses. The values in the parameter clauses conform to MIME conventions. Every line except the last must end with a semicolon (;). A physical line in this file is limited to 252 characters. You can split a logical line into multiple physical lines using the back slash (\) continuation character. Entries are terminated either by a line that does not end in a semicolon, one or more blank lines, or both.
Below is a simple example of a conversion file entry:
The clauses out-chan=ims-ms; in-type=application; in-subtype=wordperfect5.1 qualify the body part. That is, they specify the type of part to be converted. The header of each part is read and its Content-Type: and other header information is extracted. The entries in the conversion file are then scanned in order from first to last; any in-* parameters present, and the OUT-CHAN parameter, if present, are checked. If all of these parameters match the corresponding information for the body part being processed, then the conversion specified by the command= or delete= clause is performed, and the out-* parameters are set.
If no match occurs, then the part is matched against the next conversions file entry. Once all body parts have been scanned and processed (assuming there is a qualifying match), then the message is sent onwards to the next channel. If there are no matches, no processing occurs, and the message is sent to the next channel.
out-chan=ims-ms specifies that only message parts destined for the ims-ms channel will be converted. in-type=application and in-subtype=wordperfect5.1 specifies that the MIME Content-type header for the message part must be application/wordperfect5.1.
Message parts can be further qualified with additional in-* parameters. (See Table 9-5.) The entry above will trigger conversion actions on a message part which has the following MIME header lines:
After the three conversion file qualifying parameters in Code Example 9-1, the next two parameters, out-type=application and out-subtype=msword, specify replacement MIME header lines to be attached to the "processed" body part. out-type=application and out-subtype=msword specify that the MIME Content-type/subtype of the outgoing message be application/msword.
Note that since the in-type and out-type parameters are the same, out-type=application is not necessary since the conversion channel defaults to the original MIME labels for outgoing body parts. Additional MIME labels for outgoing body parts can be specified with additional output parameters.
out-mode=block (Code Example 9-1) specifies the file type that the site-supplied program will return. In other words, it specifies how the file will be stored and how the conversion channel should be read back in the returned file. For example, an html file is stored in text mode, while an .exe program or a zip file is stored in block/binary mode. Mode is a way of describing that the file being read is in a certain storage format.
The final parameter in Code Example 9-1,
command="/usr/bin/convert -in=wordp -out=msword `INPUT_FILE' `OUTPUT_FILE'"
specifies the action to take on the body part. The command= parameter specifies that a program will execute on the body part. /usr/bin/convert is the hypothetical command name; -in=wordp and -out=msword are hypothetical command line arguments specifying the format of the input text and output text; INPUT_FILE and OUTPUT_FILE are conversion channel environmental parameters (see "To Use Conversion Channel Environmental Variables") specifying a file containing the original body part and a file where the program should store its converted body part.
Instead of executing a command on the body part, the message part can simply be deleted by substituting DELETE=1 in place of the command parameter.
Conversion Channel Information Flow
The flow of information is as follows: a message containing body parts comes into the conversion channel. The conversion channel parses the message, and processes the parts one by one. The conversion channel then qualifies the body part, that is, it determines if it should be processed or not by comparing its MIME header lines to the qualifying parameters. If the body part qualifies, the conversion processing commences. If MIME or body part information is to be passed to the conversion script, it is stored in an environmental variable (Table 9-3) as specified by information passing parameters.At this point, an action specified by an action parameter, is taken on the body part. Typically the action is that the body part be deleted or that it be passed to a program wrapped in a script. The script processes the body part and then sends it back to the conversion channel for reassembling into the post-processed message. The script can also send information to the conversion channel by using the conversion channel output options. This can be information such as new MIME header lines to add to the output body part, error text to be returned to the message sender, or special directives instructing the MTA to initiate some action such as bounce, delete, or hold a message.
Finally, the conversion channel replaces the header lines for the output body part as specified by the output parameters.
To Use Conversion Channel Environmental Variables
When operating on message body parts, it is often useful to pass MIME header line information, or entire body parts, to and from the site-supplied program. For example, a program may require Content-type and Content-disposition header line information as well as a message body part. Typically a site-supplied program's main input is a message body part which is read from a file. After processing the body part, the program will need to write it to a file from which the conversion channel can read it. This type of information passing is done by using conversion channel environmental variables.Environmental variables can be created in the conversions file using the parameter-symbol-* parameter or by using a set of pre-defined conversion channel environmental variables (see Table 9-4).
The following conversions file entry and incoming header show how to pass MIME information to the site-supplied program using environment variables.
conversions file entry:
Incoming header:
in-channel=*; in-type=application; in-subtype=* specify that a message body part from any input channel of type application will be processed.
parameter-symbol-0=APPARENT_NAME specifies that the first Content-type parameter value (Draft1.doc in our example) be stored in an environment variable called APPARENT_NAME.
parameter-copy-0=* specifies that all Content-type parameters of the input body part be copied to the output body part.
dparameter-symbol-0=APPARENT_FILENAME specifies that the first Content-disposition parameter value (Draft1.doc in our example) be stored in an environment variable called APPARENT_FILENAME.
dparameter-copy-0=* specifies that all Content-disposition parameters of the input body part be copied to the output body part.
message-header-file=2 specifies that the original header of the message as a whole (the outermost message header) be written to the file specified by the environment variable MESSAGE_HEADERS.
original-header-file=1 specifies that the original header of the enclosing MESSAGE/RFC822 part are written to the file specified by the environment variable INPUT_HEADERS.
override-header-file=1 specifies that MIME headers are read from the file specified by environmental variable OUTPUT_HEADERS, overriding the original header in the enclosing MIME part. $OUTPUT_HEADERS is an on-the-fly temporary file created at the time conversion runs. A site-supplied program would use this file to store headers changed during the conversion process. The conversion channel would then read the header lines from this file when it re-assembles the body part.
override-option-file=1 specifies that the conversion channel read conversion channel options from the file named by the OUTPUT_OPTIONS environmental variable. See "To Use Conversion Channel Output Options".
command="SERVER_ROOT/msg-INSTANCE/bin/viro-scan500.sh" specifies the command to execute on the message body part.
Table 9-3    Conversion Channel Environment Variables
Environment Variable
Description
Name of the file containing the original body part. The site-supplied program should read this file.
Name of the file containing the original header lines for the body part. The site-supplied program should read this file.
Name of the file containing the original outermost header for an enclosing message (not just the body part) or the header for the part's most immediately enclosing MESSAGE/RFC822 part. The site-supplied program should read this file.
Name of the file where the site-supplied program should store its output. The site-supplied program should create and write this file.
Name of the file where the site-supplied program should store MIME header lines for an enclosing part. The site-supplied program should create and write this file. Note that file should contain actual header lines (not option=value lines) followed by a blank line as its final line.
Name of the file from which the site-supplied program should read conversion channel options. See "To Use Conversion Channel Output Options"."
To Use Conversion Channel Output Options
Conversion channel output options (Table 9-4) are dynamic variables used to pass information and special directives from the conversion script to the conversion channel. For example, during body part processing the script may want to send a special directive asking the conversion channel to bounce the message and to add some error text to the returned message stating that the message contained a virus.The output options are initiated by setting OVERRIDE-OPTION-FILE=1 in the desired conversion entry. Output options are then set by the script as needed and stored in the environmental variable file, OUTPUT_OPTIONS. When the script is finished processing the body part, the conversion channel reads the options from the OUTPUT_OPTIONS file.
The OUTPUT_OPTION variable is the name of the file from which the conversion channel reads options. Typically it is used as an on-the-fly temporary file to pass information. The example below shows a script that uses output options to return an error message to a sender who mailed a virus.
In this example, the system diagnostic message and status code are added to the file defined by $OUTPUT_OPTIONS. If you read the $OUTPUT_OPTIONS temporary file out you would see something like:
OUTPUT_DIAGNOSTIC="Virus found and deleted."
STATUS=178029946The line OUTPUT_DIAGNOSTIC='Virus found and deleted' tells the conversion channel to add the text Virus found and deleted to the message.
178029946 is the PMDF__FORCERETURN status per the pmdf_err.h file which is found in the server-root/bin/msg/imtasdk/include/pmdf_err.h. This status code directs the conversion channel to bounce the message back to the sender. (For more information on using special directives refer to "To Bounce, Delete, or Hold Messages Using the Conversion Channel Output".)
A complete list of the output options is shown below.
Headers in an Enclosing MESSAGE/RFC822 Part
When performing conversions on a message part, the conversion channel has access to the header in an enclosing MESSAGE/RFC822 part, or to the message header if there is no enclosing MESSAGE/RFC822 part. Information in the header may be useful for the site-supplied program.If an entry is selected that has ORIGINAL-HEADER-FILE=1, then all the original header lines of the enclosing MESSAGE/RFC822 part are written to the file represented by the OUTPUT_HEADERS environment variable. If OVERRIDE-HEADER-FILE=1, then the conversion channel will read and use as the header on that enclosing part the contents of the file represented by the OUTPUT_HEADERS environment variable.
To Call Out to a Mapping Table from a Conversion Entry
out-parameter-* values may be stored and retrieved in an arbitrarily named mapping table. This feature is useful for renaming attachments sent by clients that send all attachments with a generic name like att.dat regardless of whether they are postscript, msword, text or whatever. This is a generic way to relabel the part so that other clients (Outlook for example) will be able to open the part by reading the extension.The syntax for retrieving a parameter value from a mapping table is as follows:
`mapping-table-name:mapping-input[$Y, $N]'
$Y returns a parameter value. If there is no match found or the match returns $N, then that parameter in the conversions file entry is ignored or treated as a blank string. Lack of a match or a $N does not cause the conversion entry itself to be aborted.
Consider the following mapping table:
X-ATT-NAMES
postscript temp.PS$Y
wordperfect5.1 temp.WPC$Y
msword temp.DOC$YThe following conversion entry for the above mapping table results in substituting generic file names in place of specific file names on attachments:
In the example above, out-chan=tcp_local; in-type=application; in-subtype=* specifies that a message to be processed must come from the tcp_local channel with the content-type header of application/* (* specifies that any subtype would do).
in-parameter-name-0=name; in-parameter-value-0=* additionally specifies that the message must have as its first paramater type name=* (again, * specifies that any parameter value would do.)
out-type=application; specifies that the MIME Content-type parameter for the post-processing message be application.
out-subtype='INPUT-SUBTYPE'; specifies that the MIME subtype parameter for the post-processing body part be the INPUT-SUBTYPE environmental variable, which is the original value of the input subtype. Thus, if you wanted change
Content-type: application/xxxx; name=foo.doc
Content-type: application/msword; name=foo.doc
out-type=application; out-subtype=msword
out-parameter-name-0=name; specifies that the first MIME Content-type parameter of the output body part be of type name= .
out-parameter-value-0='X-ATT-NAMES:\\'INPUT_SUBTYPE\\''; says to take the first MIME subtype parameter value and search the mapping table X-ATT-NAMES for a subtype match. If a match is found, the name parameter receives the new value specified in the X-ATT-NAMES mapping table. Thus, if the parameter is of type msword, the name parameter will be temp.DOC.
To Bounce, Delete, or Hold Messages Using the Conversion Channel Output
This section describes how to use the conversion channel options to bounce, delete, or hold messages. The basic procedure is as follows:
Set OVERRIDE-OPTION-FILE=1 in the appropriate conversions file entry. This tells the conversion channel to read the output options from the OUTPUT_OPTIONS file.
A complete listing of special directives can be found in server_root/bin/msg/imtasdk/include/pmdf_err.h. The ones commonly used by the conversion channel are:Use the conversion script to determine what action is required on a particular message body part.
In the script, specify the special directive for that action by writing the STATUS=directive_code option in the OUTPUT_OPTIONS file.
NAME
Hex Value
Decimal Value
PMDF__FORCEHOLD
0x0A9C86AA
178030250
PMDF__FORCERETURN
0x0A9C857A
178029946
PMDF__FORCEDELETE
0x0A9C8662
178030178
We will explain the functions of these directives using examples.
To Bounce Messages
To bounce a message using the conversion channel set OVERRIDE-OPTION-FILE=1 in the appropriate conversions file entry and add the following line to your conversion script:echo "STATUS=178029946" >> $OUTPUT_OPTIONS
If you wish to add a short text string to the bounced message add the following line to the conversion script:
echo OUTPUT_DIAGNOSTIC=text-string >> $OUTPUT_OPTIONS
where text string is something like: "The message sent from your machine contained a virus which has been removed. Be careful about executing email attachments."
To Conditionally Delete Message Parts
It may be useful to delete parts conditionally, depending on what they contain. This can be done using the output options. By contrast, the DELETE=1 conversion parameter clause unconditionally deletes a message part.To delete a message part using the output options, set OVERRIDE-OPTION-FILE=1 in the appropriate conversions file entry and add the following line to your conversion script:
echo "STATUS=178030178" >> $OUTPUT_OPTIONS
To Hold a Message
It may be useful to hold messages conditionally, depending on what they contain. To delete a message part using the output options, set OVERRIDE-OPTION-FILE=1 in the appropriate conversions file entry and add the following line to your conversion script:echo "STATUS=178030250" >> $OUTPUT_OPTIONS
This requests that the conversion channel hold the message as a .HELD file in the conversion channel queue.
Conversion Channel Example
The CONVERSIONS mapping and set of conversion rules seen in examples below cause GIF, JPEG, and BITMAP files sent to the hypothetical channel tcp_docuprint to be converted into PostScript automatically. Several of these conversions use the hypothetical /usr/bin/ps-converter.sh to make that transformation. An additional rule that converts WordPerfect 5.1 files into Microsoft Word files is included.
CONVERSIONS
IN-CHAN=*;OUT-CHAN=tcp_docuprint;CONVERT Yes
Character Set Conversion and Message Reformatting
One very basic mapping table in Messaging Server is the character set conversion table. The name of this table is CHARSET-CONVERSION. It is used to specify what sorts of channel-to-channel character set conversions and message reformatting should be done.On many systems there is no need to do character set conversions or message reformatting and therefore this table is not needed. Situations arise, however, where character conversions must be done.
The CHARSET-CONVERSION mapping table can also be used to alter the format of messages. Facilities are provided to convert a number of non-MIME formats into MIME. Changes to MIME encodings and structure are also possible. These options are used when messages are being relayed to systems that only support MIME or some subset of MIME. And finally, conversion from MIME into non-MIME formats is provided in a small number of cases.
The MTA will probe the CHARSET-CONVERSION mapping table in two different ways. The first probe is used to determine whether or not the MTA should reformat the message and if so, what formatting options should be used. (If no reformatting is specified, the MTA does not bother to check for specific character set conversions.) The input string for this first probe has the general form:
IN-CHAN=in-channel;OUT-CHAN=out-channel;CONVERT
Here in-channel is the name of the source channel (where the message comes from) and out-channel is the name of the destination channel (where the message is going). If a match occurs the resulting string should be a comma-separated list of keywords. Table 9-6 lists the keywords.
Character Set Conversion
If the MTA probes and finds that the message is to be reformatted, it will proceed to check each part of the message. Any text parts are found and their character set parameters are used to generate the second probe. Only when the MTA has checked and found that conversions may be needed does it ever perform the second probe. The input string in this second case looks like this:IN-CHAN=in-channel;OUT-CHAN=out-channel;IN-CHARSET=in-char-set
The in-channel and out-channel are the same as before, and the in-char-set is the name of the character set associated with the particular part in question. If no match occurs for this second probe, no character set conversion is performed (although message reformatting, for example, changes to MIME structure, may be performed in accordance with the keyword matched on the first probe). If a match does occur it should produce a string of the form:
Here out-char-set specifies the name of the character set to which the in-char-set should be converted. Note that both of these character sets must be defined in the character set definition table, charsets.txt, located in the MTA table directory. No conversion will be done if the character sets are not properly defined in this file. This is not usually a problem since this file defines several hundred character sets; most of the character sets in use today are defined in this file. See the description of the imsimta chbuild (UNIX and NT) utility for further information on the charsets.txt file.
If all the conditions are met, the MTA will proceed to build the character set mapping and do the conversion. The converted message part will be relabelled with the name of the character set to which it was converted.
Message Reformatting
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.
Non-MIME Binary Attachment Conversion
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:IN-CHAN=tcp_local;OUT-CHAN=ims-ms;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 messagesnot necessarily your own site'swhich 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:
IN-CHAN=*;OUT-CHAN=tcp_msmail;CONVERT RFC1154
Relabelling MIME Headers
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.
For example, the combination of a CHARSET-CONVERSION table and MTA conversions file entries such as the following 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.)
MacMIME Format Conversions
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 ims-ms channel.
IN-CHAN=*;OUT-CHAN=l;CONVERT Appledouble
The conversion to Appledouble format would only be applied to parts already in one of the MacMIME formats.
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:
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.
Service Conversions
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=commandOf 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.
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
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.OUTPUT_FILE - Name of the output file to produce
INFO_FILE - Name of the file containing envelope recipient addresses
Previous Contents Index Next
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated February 27, 2002