Qmail
Jump to navigation
Jump to search
qmail is a secure, reliable, efficient, simple mail transport system (MTA)
Installation
On Debian/Ubuntu, install package qmail-src and run the command build-qmail
:
sudo apt-get install qmail-src
build-qmail # Follow instructions
By default, it will produce a .deb file in /tmp/qmail. Note that the resulting .deb file is linked to uid/gid on your machine. Now install the package:
sudo dpkg -i qmail_1.03-47_i386.deb
If you have a conflict with an existing MTA (like courier-mta), you'll have to remove it first:
sudo dpkg -r --force-all courier-mta # Force removal, ignore dependencies
sudo dpkg -r --force-all courier-mta-ssl
sudo dpkg -i qmail_1.03-47_i386.deb
sudo apt-get -f install # Fix broken dependencies, if any
Reference
- Package documentation, at /usr/share/doc/qmail
- check README.Debian.gz for difference between standard and Debian setups,
- check INSTALL.alias.gz, INSTALL.ctl.gz for quick walkthrough on installation,
- check TEST.deliver.gz, TEST.receive.gz for some tips on testing your new installation,
- check the FAQ.gz (virtual domains, i.e. §3 and next).
- Man pages,
man dotqmail
for the format of ~/.qmail filesman qmail-control
for list of configuration files, and corresponding man pages.
- Life with qmail, very detailed instructions
A bit of explanation
A quick summary of how things work in qmail. The objective is only to make the configuration simpler to understand. We limit ourselves to local mail delivery (no relay). For more details, please refer to man pages of each process cited below.
- Launching qmail
- On Debian, qmail is launched by the script /etc/init.d/qmail. The script starts qmail-start (unless qmail-send is still running). The script also sets the default delivery method to use if none is found by qmail (variable $alias_empty, passed to qmail-start — see also
man qmail-start
,man qmail-lspawn
,man qmail-local
).
- Receiving a mail
- Done by qmail-smtpd, which accepts only envelope recipient address with a domain listed in file rcpthosts (or address without a @). It forwards the message to qmail-queue, which basically queue it for delivery by qmail-send.
- Delivering a mail
- Mail delivery is done by qmail-send, which delivers message locally only if recipient address domain is listed in file locals. If not, qmail-send reads file virtualdomains for possible match (see
man qmail-send
). If address starts with username of a local user account (i.e. an account with a home directory), the message is delivered to that account. Otherwise the message is delivered to a special user, alias (~alias is set to /var/qmail/alias, which links to /var/lib/qmail/alias on Debian). - Delivering a mail locally
- Done by qmail-local, which delivers message to a local user or non-user account. qmail-local looks for delivery instructions in file ~/.qmail, or file ~/.qmail-ext for virtual users controlled by that user (as defined in file virtualdomains, see
man qmail-send
). If file ~/.qmail does not exist, or is empty, qmail-local follows the default delivery instruction as defined in the launch script. On Debian, the mail is forwarded to procmail, which sends the mail to /var/spool/mail as usual (bad, bad, bad, see configuration). - For virtual users, if file ~/.qmail-ext is empty, qmail-local follows the default delivery instruction. If the file does not exist, qmail-local will try several default .qmail files, and if none are found, the mail is bounced.
- Remember that mails delivered to non-user accounts (like root, postmaster...) are controlled by the special user alias. For these, qmail-local follows the delivery instructions defined by the files ~alias/.qmail*.
- See
man dot-qmail
,man qmail-local
andman qmail-send
for more details.
Configuration
We use the paths defined in the Debian package:
- /etc/init.d/qmail — Debian launch script
- /etc/qmail — Control configuration files (/var/qmail/control)