On Tue, Sep 29, 2015 at 12:29:29PM +1300, Peter wrote:

> query = (SELECT goto FROM alias WHERE address='%s' AND active)
>         UNION (SELECT goto FROM (SELECT '%u@' || target_domain goto
>         FROM alias_domain WHERE alias_domain = '%d' AND active) AS a
>         WHERE (goto IN (SELECT username FROM mailbox WHERE active) OR
>         goto IN (SELECT address FROM alias WHERE active)))

I don't think this meets the OP's needs.  He seems to want only some
of the addresses in the target domain aliased.  For that, those and
only those addresses should be listed in the virtual alias table
(whether file based or SQL):

      virtual:
        user1@alias.example     user1@target.example
        user2@alias.example     user2@target.example

Plus an appropriate setting of virtual_alias_maps.

-- 
        Viktor.

Reply via email to