I found another:

Advantage:
- no need for MTA rewriting the recipient. That is done by writing some 
SQL select anyway, so why not do it in the mailserver itself? 
Currently, it's a pain for everybody, they have to do something that's 
not documented on the wiki: rewrite recipients

postfix main.cf:
recipient_canonical_maps = pgsql:/etc/postfix/recipient_canonical.sql

where /etc/postfix/recipient_canonical.sql contains:
# ZMI 20061216 for dbmail, rewrite RECIPIENT from aliased domain to 
# final domain. Bad fix, waiting for working dbmail
user     = xxx
password = xxx
hosts    = xxx
dbname   = xxx

query = SELECT alias
   FROM dbmail_aliases left join zmi_domains on zmi_domains.client_idnr 
= dbmail_aliases.client_idnr
   WHERE zmi_domains.pridomain = ( SELECT pridomain FROM zmi_domains 
WHERE domain = substring('%s' from position('@' in '%s')+1) )
      AND substring (dbmail_aliases.alias from 1 for position('@' in 
dbmail_aliases.alias)) || zmi_domains.domain = '%s'

Just for documentation:
the zmi_domains table must not contain nested alias domains, e.g. dom1 
-> dom2 -> dom3, that must be a one way alias. That shouldn't be a 
problem, but some constraint should be defined in the DB to prevent 
multi-aliases.

mfg zmi
-- 
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0676/846914666                        .network.your.ideas.
// PGP Key:        "curl -s http://zmi.at/zmi3.asc | gpg --import"
// Fingerprint: 44A3 C1EC B71E C71A B4C2  9AA6 C818 847C 55CB A4EE
// Keyserver: www.keyserver.net                 Key-ID: 0x55CBA4EE

Attachment: pgpy7Mj52EgEN.pgp
Description: PGP signature

_______________________________________________
DBmail mailing list
DBmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to