Additional information may be available in docs/ or on the website.
For installing on GNU/Linux distributions read docs/INSTALL.linux.


Installation instructions
-------------------------

To compile masqmail you need glib (>= 2.68) (http://www.gtk.org). Your
distribution probably provides it as glib-2.0.

You need a user and a group for masqmail to run. If

	grep '^mail:' /etc/passwd
	grep '^mail:' /etc/group

shows that the user `mail' and the group `mail' exist, it's probably
best to use these. If they don't exist, create them:

	groupadd -g 12 mail
	useradd -u 8 -g mail -d /nonexistent -s /bin/false -c "masqmail MTA" mail

The 8 and 12 are common uid/gid for the user and group `mail', but you can
use any (not yet used) number you like, preferably one lower than 100.
If you use other names than `mail' and `mail', you need to use the
configure options described below.


Compiling is a matter of the usual procedure. In the source directory,
after unpacking do:

	./configure
	make
	make install



Additional options for configure
--------------------------------

See the output of

	./configure -h

Here is a selection of the options with additional explanations:

--with-user=USER
  sets the user as which masqmail will run. Default is 'mail'. USER has
  to exist before you 'make install'.

--with-group=GROUP
  sets the group as which masqmail will run. Default is 'mail'. GROUP
  has to exist before you 'make install'.

--with-logdir=LOGDIR
  sets the directory where masqmail stores its log files. It will be
  created on program startup if it does not exist. Default is
  /var/log/masqmail.

--with-spooldir=SPOOLDIR
  sets the directory where masqmail stores its spool files. It will be
  created on program startup if it does not exist. Default is
  /var/spool/masqmail.

--with-confdir=CONFDIR
  sets the default configuration directory to CONFDIR, in case you
  prefer another location than /etc/masqmail.

--with-piddir=PIDDIR
  sets the directory for the pid file of the daemon. The default and usual
  location is /var/run, but some GNU/Linux distributions have converted
  to /run/masqmail. It gets created on program startup if missing.

--with-lockdir=LOCKDIR
  sets the default directory for lock file for spooled messages. Default
  is /var/lock/masqmail. It gets created on program startup if missing.

--disable-resolver
  disables resolver support. Without the resolver functions, masqmail
  uses only gethostbyname() to resolve DNS names, and you cannot send
  mail without a smart host. Not recommended.

--disable-auth
  disables ESMTP AUTH support (enabled by default)

--disable-debug
  disables debugging; setting it on the command line or in the
  configuration has no effect. Strongly discouraged, since you miss
  valuable information if something goes wrong.


Checking the installation
-------------------------

Check that 'make install' worked correctly. The following command:

	ls -ld /usr/local/sbin/masqmail /etc/masqmail /var/log/masqmail/ \
	       /var/spool/masqmail/

should give output similar to

	-rwsr-xr-x 1 root root    399356 May 10 12:34 /usr/local/sbin/masqmail
	drwxr-xr-x 2 root root      4096 May 10 12:34 /etc/masqmail
	drwxr-xr-x 2 mail mail      4096 May 10 12:34 /var/log/masqmail
	drwxr-xr-x 5 mail mail      4096 May 10 12:34 /var/spool/masqmail

Important are the set-user-id bit for /usr/local/sbin/masqmail and
the ownership of the directories.


Making masqmail the default
---------------------------

`sendmail' is the de-facto standard name of the system's MTA, no
matter which MTA actually runs. If you want to make masqmail the
system's MTA (i.e., replace sendmail, postfix, etc), make two symbolic
links:

	ln -s /usr/local/sbin/masqmail /usr/lib/sendmail
	ln -s /usr/local/sbin/masqmail /usr/sbin/sendmail

Now every mailer that used to call sendmail will now call masqmail.
If you already had an MTA installed and running, you can kill it and
start masqmail. Probably with:

	/etc/init.d/sendmail restart

If this doesn't work as expected, you might need to add a special init
script for masqmail. Currently none is distributed with masqmail.
(Hopefully this will change soon.) Please ask on the discussion board
for help.

You can also directly start masqmail as daemon with:

	/usr/local/sbin/masqmail -bd -q30m


Basic Configuration
-------------------

The only thing you must configure in order to use masqmail is the
hostname. It's the name under which masqmail operates. In most cases
it is the same as the machine's name, but it can be different.

The script `admin/guess-hostname' tries to print the hostname of
your machine. The first output line is probably the best choice.

Create a minimal config with:

	echo "host_name = HOSTNAME" >/etc/masqmail/masqmail.conf

(Substitute `HOSTNAME' with the real value, of course.)

Such a setup (i.e., the default one) does:
- deliver mail locally
- accept mail on stdin (plain text)
- accept mail on stdin (SMTP) (if started with -bs)
- accept mail on the local port 25 (SMTP) (if started with -bd)

It does not
- transfer mail to other machines
- accept mail from outside your machine


For more elaborate setups, have a look at docs/*setup and
docs/INSTALL*. You can also take the example configuration files in
examples/ as basis for your own. Take the man pages masqmail.conf(5)
and masqmail.route(5) for reference.

All configuration files should go into /etc/masqmail.
