Re: [Exim] PostgreSQL & Aliassing Again

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Larry Rosenman
Datum:  
To: Sander Smeenk
CC: exim-users
Betreff: Re: [Exim] PostgreSQL & Aliassing Again
On Wed, 2002-08-28 at 09:12, Sander Smeenk wrote:
> Hey,
>
> I have this director that handles aliases from my pgsql database:
>
> | system_aliases:
> | driver = redirect
> | allow_defer
> | allow_fail
> | data = ${lookup pgsql{SELECT destination FROM exim_user_aliases WHERE lower(localpart) = lower('${quote_pgsql:$local_part}') AND lower(owner) = lower('${quote_pgsql:$domain}') LIMIT 1}}
> | file_transport = address_file
> | pipe_transport = address_pipe
> | retry_use_local_part
>
> This works, as shown here:
>
> | hoho=> select * from exim_aliases;
> |  id | localpart |     destination      |    owner
> | ----+-----------+----------------------+-------------
> |  24 | test      | ssmeenk@??? | domain.tld

>
> | EXPN test@???
> | 250 <ssmeenk@???>
>
> But I also want that all email to a $local_part NOT SPECIFIED in the
> database goes to 'thisuser@???'. With 'normal' aliases files
> and lsearch{} lookups, you can put a line stating:
>
> | *: thisuser@???
>
> in your aliases file and it will match any local_part not specified
> before and route all that mail to the specified email address..
>
> Unfortunately, this is not possible with SQL, because '*' doesn't match
> 'thisuser' in SQL :/
>
> Can someone tell me how I should change my director config that it
> queries the database where to send mail that doesn't match any
> local_part specified?
>
> I expirimented a bit with 'condition' rules, but it seems to just allow
> or disallow delivery.

I made the following 2, which SEEM to work in testing:

#### this looks up specific user@domain for the virtuser.
virtuser_pg:
driver = redirect
domains = pgsql;select domain from virtdomains where domain='$domain';
data = ${lookup pgsql{select rhs from virtusers where
lhs='${local_part}@${dom
ain}'}{$value}fail}


#### this looks up @domain for the virtuser.
virtuser_pg_2:
driver = redirect
domains = pgsql;select domain from virtdomains where domain='$domain';
data = ${lookup pgsql{select rhs from virtusers where
lhs='@${domain}'}{$value
}fail}


>
> Any help appreciated!
>
> Kind regards,
> Sander.
>
> --
> | Waarom worden mensen meteen geloofd als ze zeggen dat er aan de hemel
> | 400 biljoen sterren zijn, maar als je ze vertelt dat de deurpost pas
> | geverfd is moeten ze voelen!
> | 1024D/08CEC94D - 34B3 3314 B146 E13C 70C8 9BDB D463 7E41 08CE C94D
>
> --
>
> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim details at http://www.exim.org/ ##
>

--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@???
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749