mouss escribió:
> 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

s/SELECT/WHERE

>       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?

Yes, this is indeed my proposed solution... (see my former post; it seems a
bit different but that's because I don't have user and domain separated so
I need to "calculate" them from the whole email). Your former solution (in
former post) returned a domain as a result of the query, so it was not good
(recurssion wouldn't work, even for user aliases), and it didn't explain
that is was a separate table for virtual_alias_maps either. But as I said,
only the idea you gave to me was great and I thank you for it!

I don't have time now to rethink about this (I don't recall now, but the
solution has drawbacks), I'll probably return into it after 1 o 2 months...
and I'll share my results in this thread.

Thank you all for your partipation :)

Cheers,
-Román

Reply via email to