Installation procedure:

1.	If you use the BIND nameserver, you should be using (or install)
	a recent version, at least BIND 4.8.  This may involve changes
	to libc, or (usually) keeping a seperate resolver library
	(/usr/lib/libresolv.a).

	If this is not done correctly, you may get undefined symbols or
	other strange behavior from the resolver querying code in the
	router/libdb/search_res.c file.  On SunOS 4.0.3, I had to disable
	hosts file lookups (commented out HOSTS_* in hostenv/sunos4.0) to
	get the router to link.

	On Solaris 2.3 system (and others similarly behaving ones),
	which has both static, and dynamic resolver libraries this may
	be a bit of a problem, though...  System supplied one works
	fairly nicely.

2.	If you are on an Ultrix system, replace the mkdep and mklibdep
	scripts in the bin directory with the versions provided in bin/Ultrix.

3.	# ed Config
	# ed SiteConfig
	Edit the ZMailer configuration file in the toplevel directory.
	It contains definitions that will propagate to all the makefiles,
	and will appear in a file /etc/zmailer.conf which contains global
	information for ZMailer programs.

	Most notably, you need to working   hostenv/XXXX  -entry
	(and  hostenv/XXXX -file)
	[ Plan is to use GNU-Autoconfig so that this whole procedure
	  will change.. ]

4.	At the toplevel, run

		make it all

	This should compile everything, and leave a zmailer.conf file in
	the toplevel directory.  Nothing outside the source area will be
	touched.

5.	If you are currently running a zmailer, kill off all mailer processes
	using

		zmailer kill

	and save the state of your system.  This includes any active contents
	of the postoffice, as well as database files and anything else in the
	installation areas you want to be sure to keep.  This is just paranoia,
	the installation should not overwrite precious files, and will save
	old versions of distribution files in "bak" subdirectories.

	If you are currently running Sendmail, kill your SMTP server and
	drain the Sendmail queue.  There is no automatic method to requeue
	Sendmail messages under ZMailer.  If you later want to back out to
	Sendmail, all you need to do is move the /usr/lib/sendmail.bak
	binary back to /usr/lib/sendmail.

6.	Once you are safe, run:

		# make install

	or if you just want to have the new BINARIES without configs:

		# make install-bin

	This will replace your /bin/rmail and /usr/lib/sendmail programs
	(the old copy will be saved in *.bak), and install all binaries and
	the default database files.  This step should be non-destructive
	(anything replaced will be saved in a 'bak' directory, and for some
	customizable files, if they exist new versions won't replace them).

	If this is not a from-scratch installation, be aware that the
	install procedure will NOT replace some of the files in MAILSHARE
	with the equivalents from the distribution.  Specifically, the
	$MAILSHARE/cf/*, $MAILVAR/db/aliases, $MAILVAR/db/routes,
	and $MAILVAR/db/localnames files are never replaced if they
	already exist.  The $MAILSHARE/forms/* files are always replaced,
	but the old files will be saved in a 'bak' directory.

	You must now pick a toplevel router configuration file.  The
	default is provided in proto/cf/SMTP+UUCP.cf (by now copied to
	$MAILSHARE/cf/SMTP+UUCP.cf).  You need to create $MAILSHARE/router.cf.
	The simplest method is to make it symbolic link to, or copy of,
	the cf/SMTP+UUCP.cf file.

	Go into the man directory and install the manual pages by hand:

		cd man ; make install

	This step is manual because the localisms of manual page conventions
	are not predictable.  If MANDIR (from the Config file) doesn't cover
	it, you may want to customize the Makefile.

7.	If you are using the default configuration setup, the router.cf file
	expects to find a /etc/mail.conf file containing three variable
	definitions;

		# Where am I?
		orgdomain=domain
		# Who am I?
		hostname=host.subdomain.$orgdomain
		# Who do I claim to be?
		mydomain=subdomain.$orgdomain

	For example:

		orgdomain=toronto.edu
		hostname=relay.cs.$orgdomain
		mydomain=cs.$orgdomain

	Create /etc/mail.conf with appropriate contents.  If you are a
	multi-host site, determining these things can be automated according
	to your local policies and conventions.  See the files specific to
	the University of Toronto (UT*.cf) for examples of this.

	At this point, you should be able to start the router process in
	interactive mode.  Run:

		$MAILBIN/router -i

	or

		/usr/lib/sendmail -bt

	You should see something like:

		ZMailer router (2.2 #1: Thu Jul  9 00:00:00 EDT 1992)
		    you@hostname:/some/path/to/src/zmailer/router
		Copyright 1992 Rayan S. Zachariassen

		z#

	If there are errors in the configuration file, you will be told here.

	The 'z#' is the interactive prompt for root.

	It is unlikely you can do anything useful before setting up the
	data files, so get out of this by hitting EOF, or type 'exit'.

8.	Now you should merge, replace, or check the default database and
	forms files with your previous setup.

	Pay particular attention to the following items:

   ==>	$MAILVAR/db/aliases file:

	The provided skeleton aliases file on purpose contains syntax errors,
	so you are reminded to change the contents.

	You may also want to add a symbolic link from some directory in your
	path to $MAILBIN/zmailer, if you don't already have this.  We put this
	link in /local/etc.

	The aliases database is rebuilt using the $MAILBIN/newaliases script.
	This can be invoked in several ways: directly as a command if you
	have /usr/ucb/newaliases symlinked properly, or by "zmailer newaliases"
	or "sendmail -bi" if the ZMailer sendmail replacement is installed.

	Choose one of the following methods to rebuild the database:

	# $MAILBIN/newaliases
	# $MAILBIN/zmailer newaliases
	# /usr/lib/sendmail -bi
	# ln -s /usr/lib/sendmail /usr/ucb/newaliases ; /usr/ucb/newaliases

	If there are errors, correct them in the $MAILVAR/db/aliases file
	and repeat the command until the alias database has been initialized.
	The final message should look something like:

		319 aliases, longest 209 bytes, 16695 bytes total

   ==>	$MAILVAR/db/localnames file:

	Add the hostnames you want ZMailer to do local delivery for, to the
	$MAILVAR/db/localnames file.  Due to my own belief in Murphy,
	I usually add partially qualified domain names and nicknames in
	addition to canonicalized names.  If you want to do local delivery
	for mail clients, put their names in here too.  You may use pathalias-
	style .domain names in this file, to indicate everything under some
	subdomain.  Remember to sort the file.

	With the sample config files for mea's Zmailer-2.98, and latter
	this "localnames" is actually a mapping of those various names to
	the desired forms of the canonic name, thus an example:

	astro.utu.fi		astro.utu.fi
	oj287			astro.utu.fi
	oj287.astro.utu.fi	oj287.astro.utu.fi
	oj287.utu.fi		astro.utu.fi
	sirius			sirius.utu.fi
	sirius.astro.utu.fi	sirius.utu.fi
	sirius.utu.fi		sirius.utu.fi



  ==>	$MAILVAR/db/routes file:

	Add any UUCP neighbours or other special cases to this file.  For
	example (remember to keep the entries sorted):

	.toronto.ca			error!err.wrongname
	.toronto.cdn			error!err.wrongname
	alberta				uucp!alberta
	atina				smtp![140.191.2.2]
	calgary				smtp!cs-sun-fsa.cpsc.ucalgary.ca
	icnucevm.bitnet			smtp!icnucevm.cnuce.cnr.it

9.	If your hostname and UUCP node name are not identical, put your
	UUCP node name in the file /etc/name.uucp (or /etc/uucpname).

	If you are on BITNET, put your BITNET node name in /etc/name.bitnet
	(or /usr/lib/urep/BITNETNAME).

10.	At this point, you should be able to start the router again in
	interactive mode, and ask it to route addresses.  Try:

		/usr/lib/sendmail -bt

	at the prompt:

		z# router you

	should print out:

		(((local you you default_attributes)))

	Keep playing around with various addresses until you get a feel for it.

	Modify the configuration file if your setup requires it.

11.	Add the following line to /etc/services in the section for
	host-specific services:

	mailq		174/tcp			# Mailer transport queue

12.	Add something like the following lines to bootup scripts (/etc/rc.local
	or /etc/rc2.d/S99local or similar):

	if [ -r /etc/zmailer.conf ]; then
	(
		. /etc/zmailer.conf
		if [ ${MAILSERVER-NONE} = NONE -a -x $MAILBIN/zmailer ]; then
			$MAILBIN/zmailer bootclean
			$MAILBIN/zmailer & (echo -n ' zmailer')	>/dev/console
		fi
	)
	fi

	You may want to comment out startup of the Sendmail daemon.

13.	Start ZMailer:

		$MAILBIN/zmailer

14.	Keep an eye on the log files ($LOGDIR/{router,scheduler}),
	the $POSTOFFICE/postman directory for malformed message files,
	and $POSTOFFICE/deferred in case of resource problems.

15.	Add the following entry (or equivalent) to your crontab:

		28 0,8,16 * * * . /etc/zmailer.conf ; $MAILBIN/zmailer resubmit

	This will resubmit messages that have been deferred with no
	useful processing possible at time of deferral.  Adjust the
	resubmission interval to suit your environment.

	You may also want to regularly clean out the $POSTOFFICE/public
	and $POSTOFFICE/postman directories:

		7 4 * * * . /etc/zmailer.conf ; $MAILBIN/zmailer cleanup

	You may want to hardwire the location of the zmailer script.

16.	Read the notes on alias expansion in the file doc/guides/aliases and
	on mailing list maintenance in doc/guides/lists.

17.	Once satisfied that things appear to work, you may want to trim down
	logging: there are 4 kinds of logging to deal with:

	- router logs, usually kept in $LOGDIR/router.  This is the stdout
	  and stderr output of the router daemon.  If you wish to turn it off,
	  invoke router with a "-L/dev/null" option, i.e. change the zmailer
	  script.  Alternatively, modify the log() function in the
	  configuration file, or its invocations.

	- scheduler logs, usually kept in $LOGDIR/scheduler.  Same as router.

	- general mail logs, usually kept in syslog files, depending on how
	  you have configured the syslog utility (/etc/syslog.conf).  All
	  ZMailer programs log using the LOG_MAIL facility code for normal
	  messages.  You can deal with this specifically in your syslog
	  configuration file on systems with a 4.3bsd-based syslog.  The
	  following reflects the recommended configuration on SunOS 4.0:

		mail.crit		/var/log/syslog
		mail.debug		/var/log/mail

	  For pre-4.3bsd-based syslogs, you may want the syslog log file
	  to be just for important messages (e.g. LOG_NOTICE and higher
	  priority), and have a separate file for informational messages
	  (LOG_DEBUG and up).

	- By default, the postmaster will receive a copy of all bounced
	  mail; this can be turned off selectively by simply editing the
	  various canned forms used to create the error messages.  These
	  forms are located in the FORMSDIR (proto/forms in the distribution,
	  or $MAILSHARE/forms when installed).  You should review these
	  in any case to make sure the text is appropriate for your site.


Installation on clients:

The following files/programs are needed on clients:

	/etc/zmailer.conf	- the MAILSERVER variable may be set to the
				  mail server host's name.  This is not
				  required as 'mailq' will usually be able
				  to discover this by itself.

	/usr/lib/sendmail	- to submit mail

	mailq			- should be installed in the site's local
				  bin so people can query the mail server.
				  (remember to update /etc/services)

	$POSTOFFICE		- this directory from the server should 
				  be mounted and writable.

Often if the mail-folder directory is shared, also (depending upon the system):
	/usr/mail
	/usr/spool/mail
	/var/mail
	/var/spool/mail


(Rayan Zachariasen 1988-1990, Matti Aarnio 1993-1994)
