want local delivery to mailAlternateAddress; else relay message to another qmail server

Bobby Reyes <[email protected]> Tue, 14 Dec 2010 18:40:47 +0800
Newsgroups gmane.mail.qmail.ldap
Message-ID <[email protected]>
Hi.

I have installed qmail-ldap-1.03-20060201, OpenLDAP slapd 2.4.11, Courier
-IMAP, simscan, maildrop, spamassasin and clamav on Debian Lenny.

qmail-ldap is running ok but I would want to implement the following setup
(#4 below):

1. /var/qmail/control files:
me:   pb.xxx.com
locals:   pb2.xxx.com
rcpthosts:  includes pb.xxx.com and pb2.xxx.com

2. users' LDAP accounts have mail and mailAlternateAddress attribute
values:
mail:  [email protected]
mailAlternateAddress:  [email protected]

3. mails directly addressed to the mailAlternateAddress (say
[email protected]) is delivered locally successfully.

4. I would want that if a mail is addressed to a user (mail: @pb.xxx.com)
having a valid mailAlternateAddress (@pb2.xxx.com), the mail should be
delivered locally. Else, the should be forwarded/relayed to another remote
mail server.

Is this possible? How to enable this requirement? Currently, mails
mentioned in #4 (with valid @pb2.xxx.com mailAlternateAddress) are being
relayed to the remote server.

Your suggestions on this will be highly appreciated.