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).
I use a catchall for some domains instead of rejecting unknown
recipients, for exactly that reason. I find about 2-3% of catchall mai
is user errors (like mis-spellings) rather than spam.
So in this case, I can use a wildcard catchall.
So an alias map of:
@domain1.tld @domain2.tld
will produce the expected result of anyuser @ domain1.tld being
redirected to the same user (anyuser) @ domain2.tld?
That would be by far the easiest to do in my setup.
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=3D'domain1.com') then select %...@domain2..com from
virtual_alias else select alias
from virtual_alias where address=3D%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 =3D '%d'
AND
User.user =3D 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 =3D '%d'
AND
AliasDomain.destination =3D User.domain
AND
User.user =3D '%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.
This is helpful, but I still need the query to take all the other
alias domains into account. So, I need the IF condition, or a second
map.
Thank you for your help...it's informative as always!
if the wildcard alias will produce the result I need then this is
resolved.
--
Jeff Weinberger
http://disruptivemarketing.jeffweinberger.com