Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

@(#)sendmail.8 4.1 (Berkeley) 04/27/85

DELIVERMAIL 8 "4/1/81"
C 4
NAME
delivermail - deliver mail to arbitrary people
SYNOPSIS
/etc/delivermail [ - [ fr ] address ] [ -a ] [ -e x ] [ -n ] [ -m ] [ -s ] [ -i ] [ -h N ] address ...
DESCRIPTION
Delivermail delivers a letter to one or more people, routing the letter over whatever networks are necessary. Delivermail will do inter-net forwarding as necessary to deliver the mail to the correct place.

Delivermail is not intended as a user interface routine; it is expected that other programs will provide user-friendly front ends, and delivermail will be used only to deliver pre-formatted messages.

Delivermail reads its standard input up to a control-D or a line with a single dot and sends a copy of the letter found there to all of the addresses listed. If the -i flag is given, single dots are ignored. It determines the network to use based on the syntax of the addresses. Addresses containing the character `@' or the word \*(lqat\*(rq are sent to the ARPANET; addresses containing `!' are sent to the UUCP net, and addresses containing `:' or `.' are sent to the Berkeley network. Other addresses are assumed to be local.

Local addresses are looked up in a file constructed by newaliases (1) from the data file /usr/lib/aliases and aliased appropriately. Aliasing can be prevented by preceding the address with a backslash or using the -n flag. Normally the sender is not included in any alias expansions, e.g., if `john' sends to `group', and `group' includes `john' in the expansion, then the letter will not be delivered to `john'. The -m flag disables this suppression.

Delivermail computes the person sending the mail by looking at your login name. The \*(lqfrom\*(rq person can be explicitly specified by using the -f flag; or, if the -a flag is given, delivermail looks in the body of the message for a \*(lqFrom:\*(rq or \*(lqSender:\*(rq field in ARPANET format. The -f and -a flags can be used only by the special users root and network, or if the person you are trying to become is the same as the person you are. The -r flag is entirely equivalent to the -f flag; it is provided for ease of interface only.

The -e x flag controls the disposition of error output, as follows:

3n e Print errors on the standard output, and echo a copy of the message when done. It is assumed that a network server will return the message back to the user.

m Mail errors back to the user.

p Print errors on the standard output.

q Throw errors away; only exit status is returned.

w Write errors back to the user's terminal, but only if the user is still logged in and write permission is enabled; otherwise errors are mailed back.

If the error is not mailed back, and if the mail originated on the machine where the error occurred, the letter is appended to the file dead.letter in the sender's home directory.

If the first character of the user name is a vertical bar, the rest of the user name is used as the name of a program to pipe the mail to. It may be necessary to quote the name of the user to keep delivermail from suppressing the blanks from between arguments.

The message is normally edited to eliminate \*(lqFrom\*(rq lines that might confuse other mailers. In particular, \*(lqFrom\*(rq lines in the header are deleted, and \*(lqFrom\*(rq lines in the body are prepended by `>'. The -s flag saves \*(lqFrom\*(rq lines in the header.

The -h flag gives a \*(lqhop-count\*(rq, i.e., a measure of how many times this message has been processed by delivermail (presumably on different machines). Each time delivermail processes a message, it increases the hop-count by one; if it exceeds 30 delivermail assumes that an alias loop has occurred and it aborts the message. The hop-count defaults to zero.

Delivermail returns an exit status describing what it did. The codes are defined in <sysexits.h> .. .XX EX_OK Successful completion on all addresses. .XX EX_NOUSER User name not recognized. .XX EX_UNAVAILABLE Catchall meaning necessary resources were not available. .XX EX_SYNTAX Syntax error in address. .XX EX_SOFTWARE Internal software error, including bad arguments. .XX EX_OSERR Temporary operating system error, such as \*(lqcannot fork\*(rq. .XX EX_NOHOST Host name not recognized.

FILES
/usr/lib/aliases raw data for alias names

/usr/lib/aliases.dir data base of alias names

/usr/lib/aliases.pag

/bin/mail to deliver uucp mail

/usr/net/bin/v6mail to deliver local mail

/usr/net/bin/sendmail to deliver Berknet mail

/usr/lib/mailers/arpa to deliver ARPANET mail

/tmp/mail* temp file

/tmp/xscript* saved transcript

SEE ALSO
biff(1), binmail(1), mail(1), newaliases(1), aliases(5)
BUGS
Delivermail sends one copy of the letter to each user; it should send one copy of the letter to each host and distribute to multiple users there whenever possible.

Delivermail assumes the addresses can be represented as one word. This is incorrect according to the ARPANET mail protocol RFC 733 (NIC 41952), but is consistent with the real world.