D. J. Bernstein
Internet mail
qmail
Frequently asked questions

Setting up servers


How do I run qmail-smtpd under tcpserver? inetd is barfing at high loads, cutting off service for ten-minute stretches. I'd also like better connection logging.

Answer: Install ucspi-tcp. Remove the smtp line from /etc/inetd.conf, and put the two lines

     tcpserver -v -u 7770 -g 2108 0 smtp /var/qmail/bin/qmail-smtpd \
     2>&1 | /var/qmail/bin/splogger smtpd 3 &
into your system boot scripts; replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The change will take effect at your next reboot.

By default, tcpserver allows at most 40 simultaneous qmail-smtpd processes. To raise this limit to 400, use tcpserver -c 400.


How do I allow selected clients to send outgoing messages through my SMTP server? qmail-smtpd is giving the error ``sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)'' for messages to any domain not listed in /var/qmail/control/rcpthosts.

Answer: This answer assumes that you are running qmail-smtpd under tcpserver.

Create /etc/tcp.smtp containing

     1.2.3.6:allow,RELAYCLIENT=""
     127.:allow,RELAYCLIENT=""
to authorize relaying from clients with IP addresses 1.2.3.6 and 127.*. Run
     tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
Insert
     -x /etc/tcp.smtp.cdb
after tcpserver in your system boot scripts. The change will take effect at your next reboot.

If you make any changes to /etc/tcp.smtp, you must run

     tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
again. You do not have to restart tcpserver.
How do I fix up messages from dumb clients?

Answer: This answer assumes that you are running qmail-smtpd under tcpserver and have also set up tcpserver to allow those clients to relay.

Put

     fixme:fixup
into /var/qmail/control/virtualdomains, and tell qmail to read virtualdomains. Put
     | bouncesaying 'Permission denied' [ "@$HOST" != "@fixme" ]
     | qmail-inject -f "$SENDER" -- "$DEFAULT"
into ~alias/.qmail-fixup-default. Insert @fixme into RELAYCLIENT in the appropriate lines in /etc/tcp.smtp:
     1.2.3.6:allow,RELAYCLIENT="@fixme"
Finally, run
     tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
to tell tcpserver about the change. You do not have to restart tcpserver.

An alternative answer is to use the experimental ofmipd program in the mess822 package. ofmipd includes an integrated From-rewriting database and more powerful hostname rewriting features than qmail-inject.


How do I send messages by SMTP to an authorized dialup host when it makes an SMTP connection? I've heard about ETRN and AutoTURN.

Answer: This answer assumes that you are running qmail-smtpd under tcpserver.

Install serialmail and read /usr/local/doc/serialmail/AUTOTURN.

AutoTURN works with clients that send ETRN. It also works with clients that don't send ETRN.


How do I set up qmail-pop3d? My old POP server works with mbox delivery; I'd like to switch to maildir delivery.

Answer: Install ucspi-tcp and checkpassword. Put

     tcpserver 0 110 /var/qmail/bin/qmail-popup YOURHOST \
     /bin/checkpassword /var/qmail/bin/qmail-pop3d Maildir &
(on two lines) into your system boot scripts; replace YOURHOST with your host's fully qualified domain name. Set up Maildir delivery for any user who wants to read mail via POP. The new service will start after you reboot.

Security note: You should do this only within a secure network; otherwise an eavesdropper can steal passwords.

There are several programs that can be substituted for checkpassword. See http://cr.yp.to/qmail/toaster.html for more information.


How do I set up qmail-qmqpd? I'd like to allow fast queueing of outgoing mail from authorized clients.

Answer: Install ucspi-tcp. Create /etc/qmqp.tcp in tcprules format to allow connections from authorized hosts. For example, if queueing is allowed from 1.2.3.*:

     1.2.3.:allow
     :deny
Convert /etc/qmqp.tcp to /etc/qmqp.cdb:
     tcprules /etc/qmqp.cdb /etc/qmqp.tmp < /etc/qmqp.tcp
Put the line
     tcpserver -x /etc/qmqp.cdb -u 7770 -g 2108 0 628 /var/qmail/bin/qmail-qmqpd &
into your system boot scripts; replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The new service will start after you reboot.
How do I set up qmail-qmtpd?

Answer: Install ucspi-tcp. Put the line

     tcpserver -u 7770 -g 2108 0 209 /var/qmail/bin/qmail-qmtpd &
into your system boot scripts; replace 7770 with your qmaild uid, and replace 2108 with your nofiles gid. Don't forget the &. The new service will start after you reboot.
How do I record all incoming SMTP traffic?

Answer: This answer assumes that you are running qmail-smtpd under tcpserver, using tcpserver 0.84 or above, with tcpserver's connection messages being sent to syslog.

Simply insert recordio before qmail-smtpd. SMTP traffic will be sent to syslog.