On Wed, 27 Oct 1999, A.Y. Sjarifuddin wrote:

> Does smtproutes could route specific email to a specific server:
[...]
> a-p....@domain:[IP Address]
> q-z....@domain:[IP Address]

You cannot do this, because control/smtproutes is handled by
qmail-remote(8).  It checks the first argument against control/smtproutes'
first column.  Here's the excerpt from the appropriate man page:

SYNOPSIS                                                                        
       qmail-remote host sender recip [ recip ...  ]                            

You have to use control/virtualdomains and a selector script like this:

control/virtualdomains:
        domain:domainprocessor

~alias/.qmail-domain-default:
        domain/

~alias/.qmail-domainprocessor-default:
        |qsmhook -x domainprocessor- -lnP /var/qmail/bin/qmail-inject 
`/var/qmail/bin/sforwarder %u %h`

/var/qmail/bin/sforwarder:
#!/usr/bin/perl
        ($user, $domain) = @ARGV;
        open(I,"/var/qmail/alias/domains-$domain");
        while(<I>) {
                s/^([^#]*)#.*$/$1/;
                next unless ($rx, $host) =~ (/^(.+) ([a-zA-Z.-]+)\s*$/);
                if ($user =~ /${rx}/) {
                        print "$user\@$host\n";
                        close I;
                        exit;
                }
        }
        print "$domain-$user\n";
        close I;

/var/qmail/alias/domains-domain:
        ^albert$ mail.albert.com   # albert wants his own mail
        ^[a-k].+ ahost.domain.com  # ahost does users a-k
        #^z.+ zone.domain.com      # this zone is currently down
        .+ masshost.domain.com     # for old users

Ps: Iam curious if it works IRL (in the real life).  I tested just the perl
module.
-- 
Regards: Kevin (Balazs) @ synergon

Reply via email to