You should also read the man pages for dot-qmail and qmail-command.
Don't let the ~quser confuse you. ~ is unix shorthand for "home directory".
Try doing `cd ~root` and you will see that it will attempt to cd to root's
home directory.
To get this working, you need to have one dummy user for each "main" domain
that all mail for the "alternate" domains gets forwarded to. The only reason
you need this dummy user is to run the command in the .qmail-default file
which forwards the message to the intended user at the "main" domain. I
chose to set this up as a local account on the qmail server rather than an
LDAP user becuase: (1) I considered this more a part of the qmail config
than a user account, (2) this system relies on the "dash trick" which
qmail-ldap does not support unless patched (see Life with Qmail-LDPA), (3)
it seemed to add one more complication to things, and I was confused enough.
If you can get it working by putting the dummy user in LDAP, great, but why
don't you start by setting it up as a local user and make sure you can get
it to work, then work on moving it to LDAP?
So here is exactly how you should set it up:
Let's say you have one "main" domain (foo.com) with one "alternate"
(foo.net). All mail to any user @foo.net should go to @foo.com. You will
need one dummy users, named something reasonable like foouser.
Set /var/qmail/control/ldaplocaldelivery to 1. If you don't have this, then
local accounts will be ignored.
Make sure 'foo.net' IS in your rcpthosts.
Make sure 'foo.net' is NOT in your locals file.
In your virtualdomains file add the line: 'foo.net:foouser'. This means that
when any mail for [EMAIL PROTECTED] arrives, qmail will deliver it locally to
[EMAIL PROTECTED] (NOTE: At this point, I would have expected it to
deliver locally to [EMAIL PROTECTED], but looking at the Delivered-To
line in the header of a message, it says [EMAIL PROTECTED])
In ~foouser/.qmail-default (.qmail-default in foouser's home directory) put
the line:
|/var/qmail/bin/forward $[EMAIL PROTECTED]
The $DEFAULT will be whatever was after the dash in the delivery address, so
if delivered to [EMAIL PROTECTED], $DEFAULT would be "someuser", so,
the mail is forwarded to [EMAIL PROTECTED]
> From: "Ace Suares" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Sat, 14 Apr 2001 09:28:07 +0100
> To: [EMAIL PROTECTED]
> Subject: Re: Domain Forwarding
>
>
> Hi,
>
>> We talked about this on the list last week. Henning Brauer
>> straightened me out...
>
> I read that thread, but had not guessed it was about domain
> forwarding at all, sorry.
>>
>> First, read about how virtual domains work in Life with Qmail.
>
> My virtual domains run fine, without using the virtualdomains file; I
> use rcpthosts and locals and the ldap databse sorts it out.
> THe virtualdomains file has always baffled me because it is talking
> about 'users' to which domainmail is rerouted. I imagined a domain
> rewrite would happen BEFORE any user-based lookups...
>
>> Then, here's an example of how I set it up:
>>
>> in /var/qmail/control/virtualdomains:
>> nettonettech.de:quser
>> nettonettech.co.uk:quser
>> nettonettech.net:quser
>>
>> in ~quser/.qmail-default:
>
> I am confused about your solution; I am not using strange ~ signs in
> my qmail ;-) All users come from ldap and that's it. No homedirs,
> only maildirs... So I guess I should make a whole new domain
> 'domainrewrite.com' and then for every real domain add a user to the
> ldap database, like '[EMAIL PROTECTED]' and then put the
> preline/forward stuff in the DeliveryProgramPath attribute for that
> pseudo user.
>
>> |/var/qmail/bin/preline /var/qmail/bin/forward
>> $[EMAIL PROTECTED]
>
> I am not trying to be cynical, I just don't really seem to understand
> how this is working.
>
> Or is domainrewriting something that should not be in this list but
> taken to some other list concerned with plain qmail !?
>
> With Regards,
> Ace Suares
>
> PS Come to think of it, maybe this will work:
>
> 1. Create the new domain as requested.
> 2. Make an entry in the ldap databse for the domain, user info,
> mailalternateaddress catchall
> 3. add as deliveryprogrampath
> |/var/qmail/bin/preline /var/qmail/bin/forward $DEFAULT@otherdomain
>
> I'll try that now...
> _Ace
>
>
>
>
>
> | Ace Suares, Internet Consultancy and Training
> | Keizersgracht 132, 1015 CW AMSTERDAM, NL
> | phone: 06 557 06 554 (+31 6 557 06 554)
> | fax: 020 870 770 5 (+31 20 870 770 5)
> | mailto:[EMAIL PROTECTED] PGP Key idea: 0x39B81FE5
> | http://www.suares.com
>
>