2.9BSD/usr/src/ucb/delivermail/READ_ME

This directory contains the files for delivermail.  On some
installations it may also contain the source files for
auxiliary mailers.

The approximate description of each file is as follows:

TO_BE_DONE	New features to be put in (maybe) at some time.
addr.c		Routines to manipulate addresses and address
		lists.
alias.c		Does name aliasing in all forms.
alias.c.save	An old version which has a tentative (and later
		rejected) method of mail forwarding.
arpa-mailer.8	Documentation for arpa.c.
arpa.c		The auxiliary mailer for the ARPANET.
arpadate.c	A subroutine used by delivermail & arpa.c which
		creates ARPANET standard dates.
bmove.c		A core-to-core move.  This is in a separate file
		because it can easily be replaced by a blindingly
		efficient version on Vaxes.
conf.c		The configuration file.  This uses compilation flags
		from <whoami.h> to figure out what to do.
conf.skel.c	A stripped version of conf.c; if you are forced to
		build a configuration file from scratch, you are
		probably better off starting with this one.
deliver.c	Routines to deliver mail, including queueing up
		for eventual delivery & actual sending.
delivermail.8	Documentation for delivermail.
dlvrmail.h	Main header file for delivermail.
err.c		Routines to print error messages.
logmsg.3	Documentation for the message logging routines.
mail-dm.c	Example of the code in server ftp for the Arpanet
		software.
mailaliases.5	Documentation for the alias file used by delivermail.
main.c		The main routine to delivermail.  This file also
		contains some miscellaneous routines.
makefile	The makefile used here.
maketemp.c	The routine that actually reads the mail into a temp
		file.  It also does a certain amount of parsing of
		the header, etc.
matchhdr.c	A routine used by delivermail & arpa.c (& others?)
		which performs a match on ARPANET format header items.
parse.c		The routines which do address parsing.
savemail.c	Routines which save the letter on processing errors.
sysexits.c	List of error messages associated with error codes
		in sysexits.h.
sysexits.h	List of exit statuses that could someday become a
		standard.  In any case, they are what delivermail &
		a handful of other programs use.
useful.h	A header file containing a few things that appear to
		be useful for even the most various programs.
userinfo.5	Tentative documentation for the proposed (and rejected)
		user info database.
util.c		Some general purpose routines used by delivermail.
v6-mail.c	Local mailer under version 6.  This is included to
		permit you to see the sorts of modifications that
		had to take place.
vax-mail.c	Local mailer under VM/UNIX (similar for V7).  This
		is also included as an example.  This is more complex
		than v6-mail.c because it has to be able to deal with
		UUCP mail also.  Beware of local hacks that will not
		apply to your installation.
version.c	A file defining the version.  This gets bumped every
		time a new version is installed (theoretically).

[This list was current as of 10/27/80]

The configuration table distributed here should work with a vanilla
system.  It will try to figure out who you are from whoami.h.  It
depends on:
	BERKELEY -- if set, does all the Berkeley-specific stuff.
		Other local compilation flags provide machine-
		specific definition.
	V6 -- set this if you are on version 6 system.
	sysname -- a defined constant which is your name on the
		UUCP net.  It is assumed that you are on the UUCP
		net.

There are two tables in conf.c which are critical.  The first is
the Mailers table.  This describes each mailer available to your
system.  The second is the parse table, describing how to decide
what net an address applies to, etc.  The comments in the code
should explain how to set these up.  If you do not have any more
nets than berknet, uucp, and arpanet, and if the mailers for these
are in the standard places, you probably won't have to touch the
Mailers table.

You will also have to create a new makefile.  There are only two
basic types: for a v6 system & for a v7 system.  All pathnames &
system dependent stuff should be in conf.c.  The makefile distributed
is for our CSVAX site, and should work for you.  You may want to
change some of the compile flags as listed in the makefile; these
control things like logging, hashed alias tables, and debugging
info.

You will have to change your equivalent of /bin/mail to take a
"-d" flag.  If this flag is not asserted, /bin/mail should just
turn itself into /etc/delivermail (this is probably in a routine
called "bulkmail" or "sendmail").  The code looks like something
like:

# ifdef DELIVERMAIL
	{search argv for a -d flag}
	if (!dflag)
	{
		argv[0] = "-delivermail";
		argv[argc] = 0;
		execv(DELIVERMAIL, argv);
		perror(DELIVERMAIL);
	}
	{ignore -d flag in further processing}
# endif

This is actually somewhat oversimplified.  See the example mailers
for something more realistic.  Besides the mailers in this directory,
see ../berknet/v6mail.c.

Argv[0] should begin with a "-" to indicate that it is being called
from /bin/mail.

If you are running server ftp on arpanet, you will have to change
the incoming mail routine to accept mail for any address (rather than
checking to see that the user exists).  Instead of writing the
mail in some non-standard mailbox, pipe the mail to /etc/delivermail
instead (include the -a flag).  Delivermail will mail back a message
if the letter can't be sent.  Also, I have changed the "success"
message to read "Mail accepted" rather than "Mail delivered", since
the mere fact that delivermail chewed up the mail does not mean that
it has been delivered.  Our "mail-dm.c" is given as an example.

Sometimes (particularly in Arpa-land) mail comes from a person who
doesn't really exist.  Some mail will be returned to them from a
pseudo-user named ~MAILER~DAEMON~, which will of course be returned.
But ~MAILER~DAEMON~ does not exist, so it is returned.... and you have
a loop.  To break this, every site should have the entry:
	~MAILER~DAEMON~:root
in their aliases file.