DELIVER

Section: Maintenance Commands (8)
Index Return to Main Contents
 

NAME

deliver - deliver local mail  

SYNOPSIS

deliver [ options ] address ...  

DESCRIPTION

The deliver program collects a mail message from the standard input and delivers it. It is intended to take over the delivery of all local mail, a job which is usually handled by /bin/mail (that's /usr/lib/mail/mail.local on Xenix systems).

A mail system which uses deliver becomes very flexible in its handling of local mail delivery. All files used to control deliver are shell scripts. Thus anything you can express in a shell script can be used to control mail delivery.

deliver was designed for use in two environments. If your Unix system uses smail(8) to handle incoming mail, then you can change the LMAIL macro to call deliver. Or, if you have a Xenix system, deliver can be used as a direct replacement for /usr/lib/mail/mail.local. (If you are using smail under Xenix, either of these approaches will work.) deliver can also be used with sendmail or smail version 3, through the use of .forward files.

By default, deliver deposits mail in the system mailbox for the named user(s). However, deliver is useful specifically because of its ability to vary its behavior depending on the recipient(s) and content of mail messages.

When deliver starts execution, it interprets its arguments in one of three ways. If the -b (mailbox) option was specified, then all arguments are interpreted as mailbox pathnames. Otherwise, if a system delivery file exists, deliver executes it with all of deliver's arguments, interpreting the output as described below; this procedure gives the postmaster control over delivery to non-existent user names. If deliver cannot find a system delivery file, it interprets all its arguments as user names.

After executing the system delivery file (if any), deliver looks in its list of destinations for valid user names without explicitly named mailboxes. If any of those users have user delivery files in their home directories, deliver executes each delivery file with the name of the user for its only argument.  

OPTIONS

-b
Interpret all arguments as mailboxes instead of addresses.
-A
Print the resolved addresses; don't deliver to any mailboxes. Note that deliver still collects a message from the standard input, since delivery files may do different things depending on message content. For simple testing, redirect standard input from /dev/null.
-d
Be verbose; don't deliver to any mailboxes or catch any signals.
-v
Be verbose, but still deliver.
-t
Do not remove temporary files before exiting.
-r sender
Put sender on the generated From_ line. Default is to use the address on the From_ line in the input, or else the name corresponding to the real uid, or else "unknown".
-h hostname
Set the host name. The default is configuration dependent.
-s system delivery file
Specify an alternate system delivery file. The default is /usr/local/lib/deliver.sys. For security reasons, this option disables setuid privileges.
-u user delivery file
Specify an alternate user delivery file. The default is .deliver (in each user's home directory). For security reasons, this option disables setuid privileges.

All command line options are put into environment variables, which deliver examines on startup; thus all flags are propagated when deliver is invoked recursively.  

DELIVERY FILES

Delivery files are shell scripts. They are executed by deliver to control delivery to users. Note that delivery files do not control delivery to explicitly named mailboxes.

On each system the postmaster may create a system delivery file to controls delivery of all messages. The system delivery file, if it exists, is executed with the name(s) specified on the deliver command line as its arguments.

In addition, each user may create a user delivery file in his home directory. User delivery files are always executed with exactly one argument: the name of the user in whose home directory the file is found.

When deliver executes a delivery file, it sets several environment variables, listed below. Note that these environment variables are both set and used by deliver; therefore, all command line options automatically propagate when deliver is run recursively (within a delivery file). Recursive execution of deliver is quite useful, especially with the -b (mailbox) flag.

DELFLAGS
The command line flags, if any, specified on the deliver command line.
SYSDELFILE
The system delivery filename.
USERDELFILE
The user delivery filename.
HOSTNAME
The local host name, either the actual hostname or a name specified with the -h option to deliver.
SENDER
The sender, if any, specified with the -r option to deliver.
HEADER
The name of the temporary file containing the message header.
BODY
The name of the temporary file containing the message body.

deliver monitors the standard output of delivery files for lines of two forms: either "user" or "user:mailbox". Those users whose names appear in the output of a delivery file will receive the message. If a mailbox name appears after the user name, then that mailbox receives the message. If a mailbox name is not specified, the user's default mailbox is used. (The default mailbox for a user is configuration-dependent.) If a mailbox is not an absolute pathname, it is interpreted relative to the home directory of the named user.

NOTE 1: When deliver executes a delivery file, it expects that delivery file to explicitly name all users (and, optionally, mailboxes) which should receive the message. If a delivery file does not name any users in its output, then the message will not be delivered to anyone whose mail delivery is controlled by that delivery file.

Therefore, a user delivery file which contains only "exit" will keep the given user from receiving any mail. A system delivery file which contains only "exit" will cause all mail to disappear. So be careful!

NOTE 2: If deliver is setuid root -- which it should be for normal operation -- then the system delivery file is executed as root. Be very careful about its permissions and its contents! If you are not careful, it can easily become a security hole.

NOTE 3: All user delivery files are executed in the context of the user in whose home directory they reside. A user's "context" includes the uid, gid, and home directory as specified in /etc/passwd.

NOTE 4: For security reasons, if a user's home directory is writable to the world, deliver will ignore any deliver file that might be found there.

NOTE 5: For security reasons, deliver rejects lines of the form "user:mailbox" when generated by a user delivery file unless they are output by the given user's delivery file. In other words, no user can request writing a mailbox as another user.  

LOCKING

Several preprocessor labels may be defined during compilation to control the method(s) used by deliver to lock mailboxes. These labels are:

ML_DOTLOCK Lock on exclusive creation of the mailbox name with ".lock" appended. (Version 7 and early BSD mailers use this method.)

ML_DOTMLK Lock on exclusive creation of /tmp/basename.mlk, where basename is the last component of the mailbox pathname. (Xenix mailers use this method.)

ML_LOCKF Exclusively lock mailbox with lockf().

ML_FCNTL Exclusively lock mailbox with fcntl().

ML_LOCKING Exclusively lock mailbox with locking().

One or both of ML_DOTLOCK and ML_DOTMLK may be specified. At most one of ML_LOCKF, ML_FCNTL or ML_LOCKING may be specified.  

FILES

/usr/local/lib/deliver.sys system delivery file
~user/.deliver user delivery file(s)
/etc/systemid system name (Xenix only)  

SUPPORT

Enhancements, enhancement requests, trouble reports, etc., should be sent to

bugs-deliver@ateng.UUCP.

 

SEE ALSO

uux(1), smail(8), mail(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
DELIVERY FILES
LOCKING
FILES
SUPPORT
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 06:21:13 GMT, December 12, 2024