configure catch-all alias in postfix using mysql

旧街凉风 提交于 2020-01-05 02:03:27

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!