You can set up qmail to use the same local delivery agent as sendmail,
through a mechanism called qsmhook. This file says how.

Before you do this, may I ask why? If you simply don't want the hassle
of moving user mailboxes from /usr/spool/mail to ~, please reconsider---
/usr/spool/mail has always been a big security problem. See, for
example, CERT advisory 95:02.

If you're trying to preserve /etc/aliases and ~user/.forward, you're out
of luck---those are handled by sendmail internally, not by the local
delivery agent.

Perhaps you've set up an advanced agent like procmail. But most people
use procmail for nothing more than sorting mail into several mailboxes;
and that's much easier with qmail's local forwarding mechanism, which
gives each user control over user-anything. If you have a few users who
really do need procmail, they can easily run procmail from their own
.qmail files.

Do you still want to set up qsmhook? Send me some e-mail and let me know
why. Perhaps I can provide something for you in a future qmail release.

Here's what to do. First, tack ``:alias'' onto the end of each address
in /var/qmail/control/locals, and put the results into
/var/qmail/control/virtualdomains. For example, if control/locals has

   localhost
   silverton.berkeley.edu

then control/virtualdomains should now have (without extra spaces)

   localhost:alias
   silverton.berkeley.edu:alias

Second, cp /dev/null control/locals.

Third, put a line into ~alias/.qmail-default, based on sendmail's Mlocal
line. For example:

   sendmail.cf: Mlocal, P=/bin/mail, F=lsDFMPrmn, S=10, R=20, A=mail -d $u
   ~alias/.qmail-default: |qsmhook -x alias- -lsDFMPmn /bin/mail -r %g -d %u

If your delivery agent insists on being run by root, you'll have to
change "alias" to "root" in conf-user.h, recompile, and set up
~root/.qmail-default.
