jeff_homeip a écrit : > [snip] > > that creates some complications...and might be too difficult >
a script and a Makefile... or sql as below: > but why not use wildcard virtual aliases? You noted below that they break > recipient > validations. Do you mean that smtp_recipient_restrictions won't work? at all > or parts? > no, it's not about smtpd restrictions. it's about rejecting mail to invalid recipients. > Wildcard virtual aliases seems like the best way....but I want to understand > the implications > on everything esle before I proceed. > > Thanks! > >> The reason is that if you use >> @example.com @example.org >> then this breaks recipient validation: smtpd will accept >> anything^example.com, then at delivery time, the user won't be found and >> a bounce will be generated. in short, you become a source of backscatter >> (you send bounces to innocents whose addresses were forged by spammers) > > Unless I don't bounce unknown addresses.... > and you'd do what with these? if you have a catchall, it's ok. but you should not discard mail (people do mistype addresses some time, so it's not just spammers trying invalid addresses). >> you can generate the individual mappings with a script. alternatively, >> if you store users in sql, you can use sql statements to generate these >> "on the fly". examples have been posted multiple times to the list (a >> long time ago, that said, but you may be lucky...). >> >> > > it would be something like: > > if (%d='domain1.com') then select %...@domain2..com from virtual_alias else > select alias > from virtual_alias where address=%s > > (that's not quite right in the syntax, but you get the idea). This wont' > work, as I'd have to > write a special select clause for each domain I want to work this way. > assuming you have a User table containing valid email addresses and a AliasDomain table containing (alias, destination) domains: select User.user from AliasDomain, User where AliasDomain.alias = '%d' AND User.user = CONCAT('%u', '@', AliasDomain.destination) you can avoid the CONCAT inside the "search" if you split your emails in (user, domain) columns like I do. in which case, the query becomes select CONCAT(User.user, '@', User.domain) where AliasDomain.alias = '%d' AND AliasDomain.destination = User.domain AND User.user = '%u' of course, this works for "1 depth" alias domains (it doesn't work if example.net is an alis for example.org which is in turn an alias of example.com). but this should be enough in most cases.