SMAIL(8)

NAME
smail, sendmail, mailq, runq, rmail, rsmtp, smtpd, newaliases - mail delivery system

SYNOPSIS
smail [ flags ] address...
/usr/sbin/smail [ flags ] address ...
mailq
runq
rmail address ...
rsmtp
smtpd
in.smtpd
newaliases

DESCRIPTION
Smail is a program used for receiving and delivering mail. Its job is to take mail from sources on the local or on remote hosts and deliver to the appropriate destinations. This may be either on remote hosts or on the local machine. It is not intended to be a user interface for reading and submitting mail. See mailx(1) on System V, Mail(1) on BSD systems, or mail(1) on other systems for information on user interfaces.

Smail is invoked under a wide variety of names, which serve to isolate some of its major uses: receiving local mail, receiving remote mail, attempting delivery of undelivered mail and displaying information about undelivered mail.

OPTIONS
All of these commands accept the same set of flags, differing mainly in their default mode of operation. Two exceptions are the rmail and rsmtp commands which support only a subset of the possible flags. These two commands are intended to be used from remote hosts through remote execution over UUCP (see uux(1)) and are thus limited in how much they can do.

The flags which are recognized by smail are:

-bc Display the file COPYING, distributed with the source, which details your rights and restrictions for distributing this software.

-bd Listen for connection requests on a socket bound in the internet domain. When a connection occurs, conduct an SMTP (Simple Mail Transfer Protocol) conversation with the peer process. Listening will only occur if BSD style internet networking functionality is available.

-bm Deliver mail to the recipient addresses. This is the default mode of operation if invoked as sendmail, smail, rmail or send-mail.

-bp List information about the messages currently in smail's input spool directories. This is the default mode of operation if invoked as mailq. With the -v or -d flag, a per-message transaction log is displayed for each message which shows what has happened to the message so far.

-bi Initialize the aliases file, or a YP aliases file. The specific behavior of this command depends upon whether an aliases file is specified in the command with -oA file. If such an aliases file is specified, the file specifies input that will be used to build a DBM database with the same basename. The resulting DBM database is intended to be usable as a YP database. If smail was compiled with the sdbm package, distributed with smail, then the resulting database will not be usable by YP. The DBM database is rebuilt by calling mkdbm (see mkdbm(8)) with the -y option.

    If an aliases file was not specified with -oA, then the system default aliases file is rebuilt by calling the mkaliases program (see mkaliases(8) for more information).

    Both the mkdbm and mkaliases programs are executed from the directory indicated by the smail_util_dir attribute (by default /usr/lib/smail).

-bP Take the addresses given on the command line as config file variables (see smail(5) for more information) and write the values for each variable on the standard output. References to variables, such as hostnames or uucp_name which may be computed at run time, will yield the values that smail would compute normally. For example, on my workstation, the command:
    smail -bP hostnames max_message_size
    produces the output:
    futatsu.uts.amdahl.com:futatsu.amdahl.com 102400
    With the -v or -d flag the variable names are displayed as well, so that the command:
    smail -bP -v max_message_size
    produces the output:
    max_message_size=102400
    In addition to other config file variables, the name primary_name will output the primary (or canonical) name for the local host which will be used by smail, and config_file will output the name of the primary configuration file. Also, the name help will produce a verbose listing of all variables associated with their type, one variable per line, and the name all will produce a verbose listing of all variables along with their values. It is equivalent to smail -bP -v followed by a list of the names of all configuration variables.

-bR Enter the hostile mail domain of giant mail messages, and RFC standard scrolls. Attempt to make it down to protocol level 26 and back.

-bS Read SMTP commands on standard input, but do not produce SMTP replies on standard output. All failures are reported by return mail, rather than through reply codes. This is suitable for setting up a batched form of SMTP between machines over a remote execution service like UUCP. This is the default mode of operation if invoked as rsmtp.

-bs Read SMTP commands on standard input and produce SMTP replies on standard output. The currently implemented SMTP commands are HELO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, VRFY, EXPN and QUIT. This is the default mode of operation if invoked as smtpd or in.smtpd. For compatibility with some implementations of inetd(8N), if smtpd is started with no standard output, standard input will be dup(2)'d to standard output.

-bt Enter address test mode. Read addresses on standard input and produce the parse results and host routing/resolving information on standard output. This is primarily useful for debugging smail or debugging new smail routers.

-bv Verify a list of addresses by producing the list of addresses produced by aliasing and forwarding expansions and by host routing or resolving. Addresses which cannot be resolved are also displayed, along with the reasons why.

-C filename or -oC filename
    Sets the pathname of the primary config file to use in reading global attribute values. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allow smail to be set uid to the superuser. If the filename is - then no primary config file is read. This should only be used for debugging purposes.

-d[number] or -v[number]
    turn on debugging. If a number is given, set the debugging level to that value, otherwise the debugging level is set to 1. No white space is allowed before the optional number. There is no differentiation between use of -d and -v.

-D file
    Redirect debugging output to the indicated file. Normally, debugging output will disable background delivery because programs should not continue to write to standard error after the mail process exits. However, if a debug output file is specified, then background delivery can occur.

-em or -oem
    Mail errors back to the sender (default).

-ee or -oee
    These forms refer to a berkenet error processing style which is not supported. If used, errors will be mailed back to the sender.

-ep or -oep
    Write errors to the standard error output.

-eq or -oeq
    Do not send notification of errors to the sender. This only works for mail delivered locally. Errors encountered on remote hosts mail still result in returned mail. Supply a Precedence: junk header field to set this behavior on local and remote hosts.

-ew or -oew
    Write errors to the sender's terminal using the write(1) command, if he is logged in. Otherwise, mail errors back to the sender. (This is currently not supported and is treated in the same manner as -oem)

-F fullname
    Explicitly set the full name of the sender for incoming mail, used only if the operation mode is reception of a single mail message on standard input.

-f sender or -r sender
    Explicitly set the sender address for incoming mail, used only if the operation mode is reception of a single mail message on standard input.

-h number
    Sets the hopcount for a single message. If this is not specified, the hop count is computed from the number of Received: fields in the message header. The hopcount is used for a primitive form of infinite loop detection: a sufficiently large hop count will cause mail to be rejected.

-I or -oI
    Use the hidden dot algorithm in reading the message. Lines with one or more dots at the beginning have the leading dot removed, while a line containing only a single dot ends the input message. This is always set for messages received using SMTP.

-i or -oi
    Do not allow a single `.' to end an incoming message. Otherwise, a dot on a line by itself will end a message. This is the default if smail is invoked as rmail.

-m or -om
    Allow retention of the sender as a recipient for alias and mailing list expansions that include the sender. If this is Not set, the sender will not receive a copy of the message only as a result of being in an alias or mailing list.

-N  Disable delivery of this message. All other processing is performed, and transports are expected to go through most of the steps involved in delivery. This is useful for debugging smail when you do not actually wish to have messages delivered.

-n  Do not perform alias processing. This only prevents expansion of entries in alias files. Mailing list files and forward files may still be expanded.

-odb
    Deliver mail in background, if mail delivery is to be performed. Background delivery is not currently supported in the SMTP modes; foreground delivery is used instead.

-odf
    Deliver mail in foreground, if mail delivery is to be performed.

-oD filename
    Sets the pathname of the director file. This overrides the default name of the director file as well as any name set in a config file. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allow smail to be set uid to the superuser. If the filename is - then no director file is read. This should only be used for debugging purposes.

-oE filename
    Sets the pathname of the delivery retry control file. This overrides the default name of the retry file as well as any name set in a config file. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allows smail to be set uid to the superuser (the normal case). If the filename is - then no retry file is read. This should only be used for debugging purposes.

-oG grade_range
    Sets the range of grades of messages processed by a queue run. This overrides the default value of runq_grades compiled into the smail binary, as well as any name set in a config file. This may be used to allow queue processing to only process specific grades of mail, so that (for example) mailing list mail can be defered during peak periods until a time when the system load will be much lighter. Typically the config file version of the runq_grades value would be used most of the time, with the occaisional off-peak invocation of runq from cron with the -oG option set to process low priority mail. The parameter is a grade range string as used for the delivery_grades and runq_grades configuration variables.

-oL directory name
    Sets the pathname of the smail library directory. This overrides the default value of smail_lib_dir compiled into the smail binary, as well as any name set in a config file. This string may be used to locate configuration files, such as the director, router and transport files, alias and path files, and mailing list directories.

-oQ filename
    Sets the pathname of the hostname qualification file. This overrides the default name of the qualify file as well as any name set in a config file. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allows smail to be set uid to the superuser (the normal case). If the filename is - then no qualify file is read. This should only be used for debugging purposes.

-oR filename
    Sets the pathname of the router file. This overrides the default name of the router file as well as any name set in a config file. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allows smail to be set uid to the superuser (the normal case). If the filename is - then no router file is read. This should only be used for debugging purposes.

-oT filename
    Sets the pathname of the transport file. This overrides the default name of the transport file as well as any name set in a config file. If specified, then smail sets the effective uid and gid back to the real uid and gid, to avoid problems when installations allow smail to be set uid to the superuser. If the filename is - then no transport file is read. This should only be used for debugging purposes.

-Q or -odq
    Spool incoming messages but do not actually perform delivery until a later queue. This mode of operation is somewhat more efficient in terms of CPU usage, though it does slow down the flow of mail.

-q[interval]
    Cause smail to process its input spool directory. If an interval is given, smail will repeatedly check its input spool directory, sleeping for the given interval between checks. The interval is in seconds, though it can be defined as a sequence of numbers with suffixes of `s' for seconds, `m' for minutes, `h' for hours, `d' for days, `w' for weeks and `y' for years. For example, -q2h30m specifies an interval of two hours and 30 minutes. This flag is useful in conjunction with the -bd mode of operation and will cause the daemon process to wake up on these intervals and perform queue processing. Performing a single queue run is the default mode of operation if smail is invoked as runq.

-t  Extract addresses from the To:, Cc: and Bcc: fields of the message header. This is useful for user agents that do not wish to compute the recipient addresses themselves. In this mode, any addresses given on the command line are addresses that explicitly will NOT receive mail, even as a result of aliasing or forwarding expansions. This option is ignored unless smail is in the mode set by the -bm flag (which is the default mode).

-V or -bV
    Print the smail version on the standard output.

-oU Report memory usage when smail exits.

-oX mail-service
    Set the TCP/IP service name or port number to be used for listening for SMTP requests. This can used in conjunction with the -bd mode to define alternate debugging versions of the smail SMTP listening daemon, which may be useful in testing a new installation.

-oMs sender_host
    Specify the name of the system that send the mail message. This value can be included in expansion strings through the variable $sender_host.

-oMr sender_proto
    Specify the protocol that was used by the sending host to deliver the mail message. This value can be included in expansion strings through the variable $sender_proto.

-oMt ident_sender
    Specify the user that intitiated the message transfer on the previous host to get to this host. This value is set by the SMTP receiver when a message is received from a host supporting the RFC1413 protocol. This value can be included in expansion strings through the variable $ident_sender.

-oMu ident_method
    Specify the method used to determine ident_sender (above). A mail receiver that has a transmitting user identity associated with it could call smail with these flags to have that information included in the message data. This value can be included in expansion strings through the variable $ident_method.

NORMAL USAGE
Under normal usage, one smail daemon exists which receives requests from remote hosts and processes the input spool directory at intervals. Such a daemon can be started from /etc/rc with a command such as
smail -bd -q1h
which will cause queue runs at one hour intervals.

New mail can be submitted from user agents by calling smail directly and passing a message on standard input. Mailers such as BSD Mail(1) and some System V mailx(1) programs submit mail by invoking smail with a command such as
smail -em -i recipient-address ...
Because smail also works correctly if invoked as sendmail it is common to install smail as /usr/lib/sendmail so that existing binaries on BSD systems, or other systems that current run sendmail, do not need to be modified to run smail instead.

Some user agents, such as GNU Emacs may wish to have smail decipher the recipient list from the header. These programs may invoke smail with a command such as
smail -em -t -i

To receive mail over UUCP, smail can be invoked directly from uuxqt as /bin/rmail. Alternately, /bin/rmail can be another program that invokes smail directly as
smail -em -i -fsender-address recipient address ...
It is common for the System V based /bin/rmail program to perform delivery by itself, resulting in mail bypassing smail altogether. Such systems should replace /bin/rmail with a copy of smail or modify /bin/rmail so that it executes a copy of smail with the arguments as given above.

NOTE:
    In the future, a separate program may be distributed with smail to serve the function of rmail at a lower cost. This program will only write the input spool file, while allowing a smail daemon to process messages at a later time. This will save the cost of a complete exec(2) of smail for each incoming message.

An alternative method of receiving mail over UUCP is through the rsmtp command, which receives batched SMTP requests. This can be used between two sites running smail to gain many of the benefits of the SMTP protocol, such as the ability to use recipient addresses which UUX cannot correctly pass to a remote rmail program. For example, addresses containing quotes or spaces cannot be expected to pass correctly over an uux/rmail link. However a uux/rsmtp link can handle such cases.

SENDMAIL COMPATIBILITY
Smail was designed to be a plug-in replacement for the BSD sendmail program, in that external programs can call smail in the same manner that they previously called sendmail and expect similar results. However, smail is completely different internally and has entirely different configuration files. As a result, the -o option to smail only sets a few configuration parameters which were felt to be commonly used by other programs. Also, for convenience, some new (upper case only) parameters are defined only in smail. Attempts to set other options using this flag are ignored. See the OPTIONS section for the complete list of supported -o options.

Because smail can be called in a manner very similar to sendmail it is common to install smail as /usr/lib/sendmail so that no other program need be modified to use the new mailer. Thus, once properly configured, smail can be installed into a current sendmail-based environment, including an environment without access to source, with minimal effort.

SMAIL UNDER SYSTEM V
The easiest way to install smail on a System V host is to install it as /bin/rmail. An alternative is cause mailx(1) to call /usr/lib/sendmail by changine the mailx(1) configuration file /usr/lib/mailx/mailx.rc to include a line such as:
sendmail=/usr/lib/sendmail

System V's mail(1) command attempts to perform delivery by itself. Use of mail(1) to send mail should thus be discouraged unless mail(1) is modified to call smail to perform delivery.

FILES
For many sites, the compiled in configuration of smail is sufficient and thus no configuration files are needed. The following files and directories are from the default smail configuration:

/etc/smail/config
    Optional general smail configuration. This file can override compiled-in configuration.

/etc/smail/qualify
    Optional hostname qualification configuration file.

/etc/smail/directors
    Optional configuration for smail directors, i.e., configured methods for resolving local addresses. This file replaces the compiled-in director configuration.

/etc/smail/routers
    Optional configuration for smail routers, i.e., configured methods for resolving or routing to remote hosts. This file replaces the compiled-in router configuration.

/etc/smail/transports
    Optional configuration for smail transports; i.e., configured methods of mail delivery. This file replaces the compiled-in transport configuration.

/etc/smail/retry
    Optional delivery retry configuration file; i.e., minimum time between retries, and maximum time to retry before giving up.

The following files are commonly used to locally redirect mail and to give paths to remote sites.

/etc/smail/aliases
    A file of aliases for local addresses.

/etc/smail/paths
    A file of paths to remote hosts.

/etc/smail/lists
    A directory of mailing list files.

/var/spool/mail
    The directory for user mailbox files.

~/.forward
    Lists of forwarding addresses for local users.

The smail mailer typically uses the following directories for working storage, and to hold incoming mail messages.

/var/spool/smail
    The top of the spool directory hierarchy.

/var/spool/smail/input
    Smail's spool directory for incoming messages.

/var/spool/smail/error
    A directory for messages which failed for some reason that the site administrator should investigate.

/var/spool/smail/msglog
    A directory of transaction logs for individual messages.

/var/spool/smail/lock
    A directory used in smail input spool files.

The following files log the activity of the smail mailer. The system administrator should check and truncate these files from time.

/var/spool/smail/log/logfile
    A log of smail transactions.

/var/spool/smail/log/paniclog
    A log of configuration or system errors encountered by smail.

DIAGNOSTICS
Exits with 0 if no errors, non-0 otherwise. See /usr/include/sysexits.h or src/exitcodes.h in the smail source for the list of possible exit codes.

If the -bd option was used, then bind() failed: Address already in use implies that another process is already listening on the SMTP socket.

SEE ALSO
binmail(1), mailx(1) under System V, Mail(1) under BSD, pathto(1), smail(5), Smail Administration and Installation Guide, Smail Design Document, DARPA Internet Requests for Comments, RFC821, RFC822 and RFC976.

BUGS
Many mail bugs are not smail bugs. Smail can't help it if remote sites trash your mail messages.

If you find any bugs, please mail a description to the address smail-bugs@veritas.com, along with any code fixes that you may have.

Setting the input spool directory processing interval to a period of more than 2147483647 seconds is silly and will result in an incorrectly calculated processing interval.

Route-addrs on protocol level 1 are too strong.

COPYRIGHT
Copyright(C)1987, 1988 Ronald S. Karr and Landon Curt Noll
Copyright(C)1992 Ronald S. Karr
See a file COPYING, distributed with the source code, or type smail -bc for distribution rights and restrictions associated with this software.