问题
It seems like my catch-all alias doesn't work. When I use
postmap -q test@example.org mysql:/etc/postfix/mysql-virtual-alias-maps.cf
There is no output. But when I command
postmap -q jack@example.org mysql:/etc/postfix/mysql-virtual-alias-maps.cf
the output is
john@example.org.
How can I fix this?
The configure query is:
query= SELECT destination FROM virtual_aliases WHERE source='%s'
Table virtual_aliases:
id domain_id source destination
5 1 @example.org john@example.org
7 1 john@example.org john@example.org
8 1 jack@example.org john@example.org
Table virtual_domains:
id name
1 example.org
Table virtual_users:
id domain_id password email
1 1 pwd john@example.org
回答1:
Your mysql
query should be
SELECT destination FROM virtual_aliases WHERE source='%s'
UNION ALL
SELECT destination FROM virtual_aliases WHERE source='@%d'
AND NOT EXISTS (SELECT destination FROM virtual_aliases WHERE source='%s')
来源:https://stackoverflow.com/questions/23713295/configure-catch-all-alias-in-postfix-using-mysql