qmail-1.03

Introduction to qmail

Download location (HTTP):       http://www.qmail.org/qmail-1.03.tar.gz
Download location (FTP):        
Version used:                   1.03
Package size:                   225 KB
Estimated Disk space required:  4.6 MB

Additional downloads:
qmail errno patch

The qmail package contains Dan Bernstein's Mail Transport Agent (MTA). qmail provides local and remote mail delivery/relaying.

Installation of qmail

qmail needs certain user and group account to be added before installation of the software. Add the users and groups with the following commands:

mkdir /var/qmail &&
groupadd nofiles &&
useradd -g nofiles -d /var/qmail/alias alias &&
useradd -g nofiles -d /var/qmail qmaild &&
useradd -g nofiles -d /var/qmail qmaill &&
useradd -g nofiles -d /var/qmail qmailp &&
groupadd qmail &&
useradd -g qmail -d /var/qmail qmailq &&
useradd -g qmail -d /var/qmail qmailr &&
useradd -g qmail -d /var/qmail qmails

Install qmail by running the following commands:

patch -Np1 -i ../qmail-1.03.errno.patch &&
make setup check &&
./config-fast `hostname` &&
cd /var/qmail &&
touch .qmail-postmaster .qmail-mailer-daemon .qmail-root &&
chmod 644 .qmail-* &&
ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail &&
mv /var/qmail/boot/home /var/qmail/rc &&
for mandir in 1 5 7 8; do mv /var/qmail/man/man$mandir/* \
    /usr/man/man$mandir; done &&
rm -rf /var/qmail/man

Configuring qmail

Config files

/etc/inetd.conf and boot scripts

Configuration Information

If inetd is used, the following command will add the qmaild entry to /etc/inetd.conf:

echo "smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env \
tcp-env /var/qmail/bin/qmail-smtpd" >> /etc/inetd.conf

If xinetd is used, the following command will add the qmaild entry to /etc/xinetd.conf:

cat >> /etc/xinetd.conf << "EOF"
service smtp
{
    disable = no
    identifier              = smtp-local
    socket_type             = stream
    protocol                = tcp
    wait                    = no
    user                    = qmaild
    server                  = /var/qmail/bin/tcp-env
    server_args             = /var/qmail/bin/qmail-smtpd
    env                     = RELAYCLIENT=
    only_from               = 127.0.0.1
    log_on_failture         += USERID
}
EOF

To automate the running of qmail, use following command to create the init.d script:

cat > /etc/rc.d/init.d/qmail << "EOF"
#!/bin/sh
# Begin $rc_base/init.d/qmail

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org

source /etc/sysconfig/rc
source $rc_functions

case "$1" in

        start)
        echo "Starting Qmail..."
	/var/qmail/rc &
        ;;

        stop)
        echo "Stopping Qmail..."
        killall qmail-send
        ;;
		
        restart)
        $0 stop
        sleep 1
        $0 start
        ;;

        *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

# End $rc_base/init.d/qmail
EOF
chmod 755 /etc/rc.d/init.d/qmail

Create the symbolic links to this file in the relevant rc.d directory with the following commands:
cd /etc/rc.d/init.d &&
ln -sf ../init.d/qmail ../rc0.d/K25qmail &&
ln -sf ../init.d/qmail ../rc1.d/K25qmail &&
ln -sf ../init.d/qmail ../rc2.d/K25qmail &&
ln -sf ../init.d/qmail ../rc3.d/S35qmail &&
ln -sf ../init.d/qmail ../rc4.d/S35qmail &&
ln -sf ../init.d/qmail ../rc5.d/S35qmail &&
ln -sf ../init.d/qmail ../rc6.d/K25qmail

Configuring mailers to work with qmail

Configuration information for some commonly used MUAs can be found in the /var/qmail/doc/INSTALL.mbox file. Most MUAs can be configured to use qmail Mailbox format buy putting the following in ~/.profile:

MAIL=$HOME/Mailbox; export MAIL

Contents

The qmail package contains bouncesaying, condredirect, except, forward, maildir2mbox, maildirmake, maildirwatch, mailsubj, preline, qbiff, qreceipt, qmail-clean, qmail-inject, qmail-local, qmail-pop3d, qmail-popup, qmail-qstat, qmail-send, qmail-smtpd and qmail-start.

Description

bouncesaying

bouncesaying processes, possibly bouncing, incoming messages.

condredirect

condredirect processes, possibly redirecting incoming messages.

except

except reverses the exit code of a program.

forward

forward forwards new mail to one or more addresses.

maildir2mbox

maildir2mbox moves current email from an maildir-format directory to an mbox-format file.

maildirmake

maildirmake create a maildir format directory for incoming mail.

maildirwatch

maildirwatch watches a users maildir and prints a new mail summary every 30 seconds.

mailsubj

mailsubj sends a mail message with a subject supplied on the command line. The body of the message is read from standard input.

preline

preline prepends lines to a message.

qbiff

qbiff announces new mail as soon as it arrives.

qreceipt

qreceipt responds to delivery notice requests.

qmail-clean

qmail-clean cleans up the queue directory.

qmail-inject

qmail-inject preprocesses and sends a mail message.

qmail-local

qmail-local delivers or forwards mail messages.

qmail-pop3d

qmail-pop3d accesses users' pop3 mail accounts.

qmail-popup

qmail-popup reads pop3 usernames and passwords.

qmail-qstat

qmail-qstat summarizes mail queue statistics.

qmail-send

qmail-send delivers mail from the message queue.

qmail-smtpd

qmail-smtpd receives mail via SMTP.

qmail-start

qmail-start enables mail delivery services, spawning qmail-send, qmail-lspawn, qmail-rspawn, and qmail-clean.