SM(8zm)

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(8zm), 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 | /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 presence 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(8zm) and their comparisons against sendmail-8.11 are:

-
    sendmail: Not defined/used

    sm: Special ``no flags defined'' dummy entry

:, |, /, %, @
    sendmail: various sendmail-specific things that are handled mostly by the router(8zm) subsystem at ZMailer.

    sm: Not used.

0
    sendmail: Equivalent of ZMailer's smtp(8zm) transport agents -x option. (Don't use MX data, only addresses)

    sm: Not used

1, 2
    sendmail, sm: Not defined/used

3
    sendmail: Extend the list of characters converted to =XX notation when converting to Quoted-Printable to include those that don't map cleanly between ASCII and EBCDIC. Usefull if you have IBM mainframes on site.

    sm: Not implemented/used

4
    sendmail, sm: Not defined/used

5
    sendmail: Local delivery alternate resolution ruleset (R5) in case no aliases are found for currently processed address. (Meaningless in ZMailer; router's task)

    sm: Not used

6
    sendmail: Strip RFC 822 headers to 7 bits.

    sm: Not implemented/used

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

    sm: Will strip the 8th bit of every character of the message body, does not touch message headers. (Not stripping message header is sort of BUG.)

8
    sendmail, sm: Tells that the recipient system is 8-bit capable and that no 8->7 downgrading is needed.

9
    sendmail, sm: If set, do limited 7->8 bit MIME conversions. These conversions are limited to text/plain data.

a
    sendmail: Run ESMTP protocol on the SMTP connection

    sm: Not implemented/used (See ``B'') (SMTP transport agent's task)

A
    sendmail: Look up the user part of the address in the alias database

    sm: Not used (Router's task)

b
    sendmail: Force a blank line on the end of a message. (Not needed in sm's usage environment.)

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

B
    sendmail: Not defined/used

    sm: 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.

c
    sendmail: Do not include comments in RFC 822 header addresses.

    sm: not implemented/used

C
    sendmail: Header address canonicalization

    sm: Not used (router's task)

d
    sendmail: Do not include angle brackets around route-address syntax addresses. (this is broken security trick for some shell script usages, nor recommented!)

    sm: Not implemented/used

D
    sendmail: ``Date:'' header wanted

    sm: Not used (router's task)

e
    sendmail: This mailer is expensive to connect, connections only from queuerun. (Meaningless in sm)

    sm: Throw in a collection of ``X-Envelope-*:'' headers; specifically:

        Envelope-Id:
            This is one for the message, if it has been defined in incoming message.

        X-Envelope-To:

        Original-Recipient:
            These two appear in sequence, and the first should exist for every message in the system.

    Frankly, it does not make much sense to use this in combination with e.g. 'm'-mode (multi-recipient processing).

E
    sendmail, sm: Will prepend ``>'' to any message body line starting with ``From '' (From space).

f
    sendmail, sm: adds ``-f sender'' arguments to the delivery program.

F
    sendmail: This mailer wants ``From:'' header line.

    sm: Not used (Router's task)

g
    sendmail: Affects on what to use as error source envelope address

    sm: Not used (Scheduler's task)

G
    sendmail, sm: Not used

h
    sendmail, sm: Not used

H
    sendmail: Not used

    sm: 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.

i
    sendmail: Do User Database rewriting on envelope sender address

    sm: Not used (router's task)

I
    sendmail: The remote system is another sendmail, use special protocol features

    sm: Not used

j
    sendmail: Do User Database rewriting on envelope recipients as well as senders.

    sm: not implemented/used (router's task)

J
    sendmail, sm: Not used

k
    sendmail: Allow network connection to myself (for very unusual usage cases, likely sendmail running at another port)

    sm: not used (See ZMailer smtp(8zm) transport agent.)

K
    sendmail: Currently unimplemented, reserved for CHUNKING.

    sm: Not used

l
    sendmail: This mailer is local (i.e., final delivery will be performed)

    sm: Not used (semi meaningless)

L
    sendmail: Limit the line lengths as specified in RFC 821. (This is deprecated option.)

    sm: Not used

m
    sendmail, sm: This mailer can hangle multiple recipients; Existence of $u macro in argv part of the mailer definition will be expanded with recipients.

M
    sendmail: ``Message-ID:'' header wanted

    sm: Not used (Router's task)

n
    sendmail, sm: Do not prepend a From-space line (normal mailbox separator line) to the message.

o
    sendmail Always run as the owner of the recipient mailbox

    sm: Meaningless, not used (ZMailer's sm is not really for doing local delivery - but see how procmail can be driven.)

O
    sendmail: Not used.

    sm: Outputs the Original-Recipient: meta-header for each recipient of the message. This carries incoming SMTP protocol ORCPT= parameter, if any.

p
    sendmail: Use route-addr style reverse-path in the SMTP ``MAIL FROM:'' command rather than just the return address.

    sm: Meaningless, not used. (smtp transport agent's task.)

P
    sendmail, sm: Header ``Return-Path:'' is wanted to be added to the message.

q
    sendmail: Some SMTP VRFY related thing, not applicable to ZMailer

    sm: Not used.

Q
    sendmail, sm: Not used.

r
    sendmail, rm: adds ``-r sender'' arguments to the delivery program.

R
    sendmail: Open SMTP connections from a ``secure'' port. (Meaningless in ZMailer, but see smtp(8zm) transport agent.)

    sm: Use CRLF sequence as end-of-line sequence. Without it, will use LF-only end-of-line sequence.

s
    sendmail: Strip quote characters (" and \) off of the addresses before calling the actual mailer.

    sm: Not implemented/used.

S
    sendmail, sm: 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 (which is not recommended!)

t, T
    sendmail, sm: Not used

u
    sendmail: Upper case should be preserved in user names for this mailer. Standards require preservation of cae in the local part of addresses, except for those addresses for which your system accepts responsibility.

    sm: Not used

U
    sendmail, sm: 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(1zm) programs for incoming UUCP mail.

v, V
    sendmail, sm: Not used

w
    sendmail: The user must have a valid account on this machine, i.e., getpwnam() must succeed. If not, the mail is bounced. (Local delivery stuff.)

    sm: Not used.

W
    sendmail, sm: Not used

x
    sendmail: A ``Full-Name:'' header is wanted.

    sm: Not implemented/used

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

y, Y
    sendmail, sm: Not used

z
    sendmail: Run Local Mail Transfer protocol (LMTP) between sendmail and the local mailer. See RFC 2033.

    sm: Not implemented/used. ZMailer's smtp(8zm) implements LMTP.

Z
    sendmail, sm: Not used

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>.

SUBPROCESS ENVIRONMENT

TO BE WRITTEN

ENVIRONMENT VARIABLES

ZCONFIG
    This environment variable is expected to be inherited from the scheduler(8zm), and it tells where scheduler's idea of ZENV-variables are located at.

Z-ENVIRONMENT VARIABLES

DEFCHARSET

MAILSHARE

MAILBIN

whatever

FILES

@ZMAILERCFGFILE@ | (ZCONFIG)
@POSTOFFICE@ | (POSTOFFICE)
@MAILSHARE@/sm.cf | (MAILSHARE/sm.cf)

SEE ALSO
scheduler(8zm), smtp(8zm), zmailer.conf(5zm).

AUTHOR
This program authored and copyright by:
    Rayan Zachariassen <no address>
Several extensions by:
    Matti Aarnio <mea@nic.funet.fi>