>> So I came up with this: >> >> query = select if ('%d' = 'example-2.com', IFNULL((select > dest >> from aliases where addr = '%u...@example.com'), (select addr from > users >> where addr = '%u...@example.com')), (select dest from aliases where > addr = >> '%s')) >> >> This seems to work in all cases except when I send to >> "postmas...@example-2.com" because I have an alias with just the > local >> part: >> >> postmaster r...@example.com >> >> This causes a bounce instead of reject. > > Oops. I mean it causes a bounce (not instant reject) (bounce says > "postmas...@example-2.com is invalid) instead of being delivered correctly
It also causes this problem when sending to "postmas...@example.com" 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? >