>> So I came up with this:
>>
>> query = select if ('%d' = 'example-2.com', IFNULL((select
> dest
>> from aliases where addr = '%[email protected]'), (select addr from
> users
>> where addr = '%[email protected]')), (select dest from aliases where
> addr =
>> '%s'))
>>
>> This seems to work in all cases except when I send to
>> "[email protected]" because I have an alias with just the
> local
>> part:
>>
>> postmaster [email protected]
>>
>> This causes a bounce instead of reject.
>
> Oops. I mean it causes a bounce (not instant reject) (bounce says
> "[email protected] is invalid) instead of being delivered correctly
It also causes this problem when sending to "[email protected]" which is
not good (looking at the SQL I am not sure why that happens)
>> Do I have to add a clause for this to my
>> query? I start to feel like I'm doing things Postfix should be doing.
> There
>> must be a more simple way to do this?
>