SM(8)

NAME
sm - zmailer Sendmail compatible transport agent

SYNOPSIS
sm [ -8HQV ] [ -f configfile ] -c channel -h host mailer

DESCRIPTION
sm is a ZMailer transport agent which is usually only run by the scheduler(8), to deliver messages by invoking a program with facilities and in a way compatible with a Sendmail mailer. The sm program must be run with the same current directory as the scheduler, namely POSTOFFICE/transport.

The program scans the message control files named on stdin for addresses destined for the channel and/or the host given on the command line. If any are found, all matching addresses and messages are processed according to the specifications for the mailer in the configuration file.

The exit status of a mailer should be one of the standard values specified in <sysexits.h>. Of these, EX_OK indicates successful deliver, and EX_DATAERR, EX_NOUSER, EX_NOHOST, EX_UNAVAILABLE, and EX_NOPERM indicate permanent failure. All other exit codes will be treated as a temporary failure and the delivery will be retried.

OPTIONS

-8  tells that the output is 8-bit clean, and for any MIME message with QUOTED-PRINTABLE encoding the coding can be decoded.

-Q  tells that the transport channel will likely treat poorly control characters like TAB, and possibly SPACE too.. This encodes them all by using QUOTED-PRINTABLE encoding.

-f configfile
    specifies the name of a configuration file containing specifications of the various known Sendmail compatible mailer programs: how to invoke them and how to process messages for them. The default is MAILSHARE/sm.cf.

-c channel
    specifies which channel name should be keyed on. There is no default. If this option is not specified, the -h option must be.

-h host
    specifies which host name should be keyed on. There is no default. If this option is not specified, the -c option must be.

-V  prints a version message and exits.

CONFIGURATION
The configuration file associates the mailer keyword from the command line with a specification of a delivery program. This is very similar to the way the definition of a mailer in Sendmail requires flags, a program name, and a command line specification. These are in fact the fields of the entries of the configuration file. Lines starting with whitespace or a ``#'' are ignored, and all others are assumed to follow this format:

mailer	flags	program	argument list

For example:

local	mS	sm/localm	localm -r $g $u
prog	-	/bin/sh	sh -c $u
tty	rs	/usr/local/to	to $u
uucp	U	/usr/bin/uux	uux - -r -a$g -gC $h!rmail ($u)
usenet	m	sm/usenet	usenet $u
ean	mn	/local/lib/ean/gwsmean	gwsmean -d $u
test	n	sm/test	test $u
smsgw	nS	${MAILBIN}/sms-gw sms-gw $g $u

The mailer field extends from the beginning of the line to the first whitespace. It is used simply as a key index to the configuration file contents. Whitespace is used as the field separator for all the fields.

The flags field contains a concatenation of one-letter flags. If no flags are desired, a ``-'' character should be used to indicate presense of the field. All normal Sendmail flags are recognized, but the ones that do not make sense in the context of ZMailer will produce an error. The flags that change the behaviour of sm are:

b   will activate BSMTP-type wrapping with ``hidden-dot'' algorithm; e.g. quite ordinary SMTP stream, but in "batch mode".

B   The first ``B'' turns on similar BSMTP wrapping as ``b'', but adds SIZE and, if the sm is started with option ``-8'', also 8BITMIME options. The second ``B'' adds there also DSN (Delivery Status Notification) parameters.

H   Adds ``HELO'' or ``EHLO'' into front of the BSMTP stream. Normally the BSMTP streams do not have ``HELO/EHLO'' in front of them to avoid problems with catenation of BSMTP messages for streamed UUCP transfers, for example.

E   will prepend ``>'' to any message body line starting with ``From '' (From space).

f   adds "-f sender" arguments to the delivery program.

n   will not prepend a From-space line (normal mailbox separator line) to the message.

r   adds "-r sender" arguments to the delivery program.

S   will run the delivery program with the same real and effective uid as the sm process. If this flag is not set, the delivery program will be run with the real uid of the sm process. This may be useful if sm is setuid.

m   informs sm that each instance of the delivery program can deliver to many destinations. This affects $u expansion in the argument list, see below.

P   prepends a Return-Path: header to the message.

U   will prepend a From-space line, with a "remote from myuucpname" at the end, to the message. This is what is expected by remote rmail(1) programs for incoming UUCP mail.

R   use CRLF sequence as end-of-line sequence. Without it, will use LF-only end-of-line sequence.

X   does SMTP-like 'hidden-dot' algorithm of doubling all dots that are at the start of the line.

7   will strip (set to 0) the 8th bit of every character in the message.

The path field specifies the location of the delivery program. Relative pathnames are allowed and are relative to the MAILBIN directory, but also dollar-expressions of type: ${ZENVAR}

The arguments field extends to the end of the line. It contains whitespace-separated argv parameters which may contain one of the following sequences:

$g  which is replaced by the sender address.

$h  which is replaced by the destination host.

$u  which is replaced by the recipient address. If the -m mailer flag is set and there are several recipients for this message, the argument containing the $u will be replicated as necessary for each recipient. (Also ${ZENVAR} expressions are allowed!)

INTERFACE
This program reads in processable file names relative to the current working directory of the scheduler (namely: $POSTIOFFICE/transport/). Optionally on the same line the scheduler may tell which host is to be looked for from the recipients of the message.

	relative-spool-path [ <TAB> hostname ]

This program produces diagnostic output on the standard output. Normal diagnostic output is of the form:

	id/offset<TAB>notify-data<TAB>status message

where id is the inode number of the message file, offset is a byte offset within its control file where the address being reported on is kept, status is one of ok, error, or deferred, and the message is descriptive text associated with the report. The text is terminated by a linefeed. Any other format (as might be produced by subprocesses) is passed to standard output for logging in the scheduler log.

The exit status is a code from <sysexits.h>.

FILES
/etc/zmailer.conf
/var/spool/postoffice (POSTOFFICE)
/local/share/mail/sm.cf (MAILSHARE/sm.cf)

SEE ALSO
scheduler(8)

AUTHOR
This program authored and copyright by:
Rayan Zachariassen <rayan@cs.toronto.edu>
Several extensions by:
Matti Aarnio <mea@nic.funet.fi>