D. J. Bernstein
Internet mail
qmail
Frequently asked questions

Administration


How do I tell qmail to read locals and virtualdomains? I just changed the files; qmail-send is still running with the old files.

Answer: Find the qmail-send process and give it a HUP signal. Alternatively, if qmail is supervised:

     svc -h /service/qmail

You can instead restart qmail. qmail-send will read the new files when it starts up.


How do I safely stop qmail-send? Back when we were running sendmail, it was tricky to kill sendmail without risking the loss of current deliveries. What should I do with qmail-send?

Answer: Find the qmail-send process and give it a TERM signal. It will shut down cleanly after current deliveries stop. Wait for ``exiting'' to show up in the log. To restart qmail, run /var/qmail/rc the same way it is run from your system boot scripts, with the proper PATH, resource limits, etc.

Alternatively, if qmail is supervised:

     svc -t /service/qmail
The supervise process will kill qmail, wait for it to stop, and restart it. Use -d instead of -t if you don't want qmail to restart automatically; to restart it, use -u.
How do I manually run the queue? I'd like qmail to try delivering all the remote messages right now.

Answer: Find the qmail-send process and give it an ALRM signal. Alternatively, if qmail is supervised:

     svc -a /service/qmail
You may want to run qmail-tcpok first, to guarantee that qmail-remote will try all addresses. Normally, if an address fails repeatedly, qmail-remote leaves it alone for an hour.
How do I run a supervised copy of qmail? svc sounds useful.

Answer: Install daemontools version 0.60 or above. Make sure that supervise is in the system startup PATH. Create a /service/qmail directory:

     mkdir /service/qmail
     ln -s /var/qmail/rc /service/qmail/run
Change
     /var/qmail/rc
to
     supervise /service/qmail
in your boot scripts. Now you can use svc to stop or restart qmail, and svstat to check whether qmail is running.
How do I avoid syslog? It chews up a lot of CPU time and throws away log entries under high loads.

Answer: Install daemontools 0.60 or above. Make a /var/log/qmail directory, owned by qmaill, mode 2700. Replace

     splogger qmail
in /var/qmail/rc with
     multilog t /var/log/qmail
Make sure that multilog is in the system startup PATH.

By default, multilog keeps 10 automatically rotated log files, each containing up to 100KB of log data. To keep 20 files with 1MB each, use multilog t s1000000 n20 /var/log/qmail.

If you are logging tcpserver connections, make a /var/log/smtpd directory, and use multilog /var/log/smtpd for tcpserver. Don't run two simultaneous multilog processes with the same log directory.


How do I rejuvenate a message? Somebody broke into Eric's computer again; it's going to be down for at least another two days. I know Eric has been expecting an important message---in fact, I see it sitting here in /var/qmail/queue/mess/15/26902. It's been in the queue for six days; how can I make sure it isn't bounced tomorrow?

Answer: Simply touch /var/qmail/queue/info/15/26902.

This is the only form of queue modification that is safe while qmail is running.


How do I keep a copy of all incoming and outgoing mail messages?

Answer: Set QUEUE_EXTRA to "Tlog\0" and QUEUE_EXTRALEN to 5 in extra.h. Recompile qmail. Put ./msg-log into ~alias/.qmail-log.

You can also use QUEUE_EXTRA to, e.g., record the Message-ID of every message: run

     | awk '/^$/ { exit } /^[mM][eE][sS][sS][aA][gG][eE]-/ { print }'
from ~alias/.qmail-log.