<CHAPTER ID="ZADM-SM"><?dbhtml filename="zadm-sm.html">
<TITLE><EMPHASIS>Sm</> Configuration</TITLE>

<PARA>
<EMPHASIS>sm</> is a ZMailer's <COMMAND>sendmail</>(8) compatible
<EMPHASIS>transport agent</> to deliver messages by invoking a program
with facilities and in a way compatible with a <COMMAND>sendmail</>(8)
MTA.
</PARA>

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

<PARA>
The exit status of a mailer should be one of the standard values specified in
 <EMPHASIS>#include &lt;<FILENAME CLASS="HEADERFILE">sysexits.h</>&gt;</>.
Of these, <ERRORCODE>EX_OK</> indicates successful deliver, and
 <ERRORCODE>EX_DATAERR</>, <ERRORCODE>EX_NOUSER</>, <ERRORCODE>EX_NOHOST</>,
 <ERRORCODE>EX_UNAVAILABLE</>, and <ERRORCODE>EX_NOPERM</> indicate
permanent failure.
All other exit codes will be treated as a temporary failure and the delivery
will be retried.
</PARA>

<PARA>
Usage:

<CMDSYNOPSIS>
<COMMAND>sm</COMMAND>
  <ARG>-8</ARG>
  <ARG>-H</ARG>
  <ARG>-Q</ARG>
  <ARG>-V</ARG>
  <ARG>-f <REPLACEABLE>configfile</></ARG>
  <ARG CHOICE=PLAIN>-c <REPLACEABLE>channel</></ARG>
  <ARG CHOICE=PLAIN>-h <REPLACEABLE>host</></ARG>
  <ARG CHOICE=PLAIN><REPLACEABLE>mailer</></ARG>
</CMDSYNOPSIS>
</PARA>

<PARA>
Configuration:
</PARA>

<PARA>
The configuration file <FILENAME>$<VARNAME>MAILSHARE</>/sm.conf</>
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
<COMMAND>sendmail</>(8).
It 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 ``<EMPHASIS ROLE="STRONG">#</>''
are ignored, and all others are assumed to follow format shown in figure
<XREF LINKEND="fig.adm.sample-sm-conf">.
</PARA>

<FIGURE ID="fig.adm.sample-sm-conf" PGWIDE="1" FLOAT="1">
<TITLE>Sample <FILENAME>sm.conf</> file</TITLE>
<SCREEN>
#mailer flags program        argument list
#------ ----- -------------- --------------------------------
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
test    n     sm/test        test $u
</SCREEN>
</FIGURE>

<PARA>
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.
One or more whitespace is used as the field separator for all the fields.
</PARA>

<PARA>
The flags field contains a concatenation of one-letter flags.
If no flags are desired, a ``<EMPHASIS ROLE="STRONG">-</>''
character should be used to indicate presence of the field.
All normal <APPLICATION>sendmail</> (<EMPHASIS>of 5.x era..</>)
flags are recognized, but the ones that do not make sense in
the context of ZMailer will produce an error (or some are ignored).
The flags that change the behaviour of <EMPHASIS>sm</> are:

<VARIABLELIST>
<VARLISTENTRY><TERM><OPTION>b</OPTION></TERM><LISTITEM><PARA>
will activate BSMTP-type wrapping with a ``hidden-dot''
algorithm; e.g. quite ordinary SMTP stream, but in ``batch mode''.
</PARA></LISTITEM></VARLISTENTRY>

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

<VARLISTENTRY><TERM><OPTION>E</OPTION></TERM><LISTITEM><PARA>
will prepend ``<OPTION>&gt;</>'' to any message body line starting
with ``<EMPHASIS ROLE="STRONG">From </>''. (Read: ``From-space'')
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>f</OPTION></TERM><LISTITEM><PARA>
adds ``<OPTION>-f sender</>'' arguments to the delivery program.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>n</OPTION></TERM><LISTITEM><PARA>
will not prepend a ``<EMPHASIS ROLE="STRONG">From </>''-line
(normal mailbox separator line) to the message.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>r</OPTION></TERM><LISTITEM><PARA>
adds ``<OPTION>-r sender</>'' arguments to the delivery program.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>S</OPTION></TERM><LISTITEM><PARA>
will run the delivery program with the same real and effective uid as
the <EMPHASIS>sm</> process.
If this flag is not set, the delivery program will be run with the real
uid of the <EMPHASIS>sm</> process.
This may be useful if <EMPHASIS>sm</> is setuid.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>m</OPTION></TERM><LISTITEM><PARA>
informs <EMPHASIS>sm</> that each instance of the delivery program
can deliver to many destinations.
This affects <OPTION>$u</>  expansion  in the argument list, see below.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>P</OPTION></TERM><LISTITEM><PARA>
prepends a ``Return-Path:'' header to the message.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>U</OPTION></TERM><LISTITEM><PARA>
will prepend a ``<EMPHASIS ROLE="STRONG">From </>''-line, with
a ``remote from myuucpname'' at the end, to the message.
This is what is expected by remote  <COMMAND>rmail</>(1)
programs for incoming UUCP mail.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>R</OPTION></TERM><LISTITEM><PARA>
use CRLF sequence as end-of-line sequence. Without
it, will use LF-only end-of-line sequence.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>X</OPTION></TERM><LISTITEM><PARA>
does SMTP-like ``hidden-dot'' algorithm  of doubling
all dots that are at the start of the line.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>7</OPTION></TERM><LISTITEM><PARA>
will strip (set to 0) the 8th bit of every character in the message.
</PARA></LISTITEM></VARLISTENTRY>
</VARIABLELIST>
</PARA>

<PARA>
The path field specifies the location of the delivery program.
Relative pathnames are allowed and are relative to the
<FILENAME CLASS="DIRECTORY">$<VARNAME>MAILBIN</>/</> directory.
</PARA>

<PARA>
The arguments field extends to the end of the line.
It contains whitespace separated <OPTION>argv</> parameters which may
contain one of the following sequences:

<VARIABLELIST>
<VARLISTENTRY><TERM><OPTION>$g</OPTION></TERM><LISTITEM><PARA>
which is replaced by the sender address.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>$h</OPTION></TERM><LISTITEM><PARA>
which is replaced by the destination host.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>$u</OPTION></TERM><LISTITEM><PARA>
which is replaced by the recipient address.
If the ``<OPTION>m</>'' mailer flag is set and there are several
recipients for this message, the argument containing the ``<OPTION>$u</>''
will be replicated as necessary for each recipient.
</PARA></LISTITEM></VARLISTENTRY>
</VARIABLELIST>
</PARA>

</CHAPTER>
