Roman Medina-Heigl Hernandez a écrit : > [snip] > Any ideas to improve this? I think this could be solved with more mysql > magic... >
let's use these "simplistic" tables (no id/keys... for simplicity): - a User table, with the following columns * user: the user-part of an email address * domain: the domain part. - a DomainAlias table, with the following columns * alias: This is a domain name * destination: This too is a domain name now, we set virtual_alias_maps = # user aliases proxy:mysql:/etc/postfix/maps/mysql/user_alias # domain aliases proxy:mysql:/etc/postfix/maps/mysql/domain_alias user_alias is used for "user" aliases (no wildcard alias). You already know how to do this so I'll skip it. domain_alias is used for domain aliasing. The query is query = SELECT user FROM DomainAlias, User SELECT alias = '%d' AND User.user = '%u' AND User.domain = destination so there are two things: - we use two maps in virtual_alias_maps. one for users and one for domains. the latter implements wildcard aliases - but we only return a result if the "destination" user exists (in the User table). is it clear now?