From bbc2c25d29a75e81e51d01c57668eb1808f97ca6 Mon Sep 17 00:00:00 2001 From: Felix Date: Sat, 27 Sep 2014 15:13:40 +0200 Subject: [PATCH] FIxes #200 Added a second virtual_alias_map so that emails to existing users won't be caught from an catchall alias --- setup/mail-users.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setup/mail-users.sh b/setup/mail-users.sh index e5289057..f8ece6cf 100755 --- a/setup/mail-users.sh +++ b/setup/mail-users.sh @@ -77,7 +77,8 @@ tools/editconf.py /etc/postfix/main.cf \ tools/editconf.py /etc/postfix/main.cf \ virtual_mailbox_domains=sqlite:/etc/postfix/virtual-mailbox-domains.cf \ virtual_mailbox_maps=sqlite:/etc/postfix/virtual-mailbox-maps.cf \ - virtual_alias_maps=sqlite:/etc/postfix/virtual-alias-maps.cf \ + virtual_alias_maps=sqlite:/etc/postfix/virtual-alias-maps.cf, \ + sqlite:/etc/postfix/virtual-self-alias-maps.cf \ local_recipient_maps=\$virtual_mailbox_maps # SQL statement to check if we handle mail for a domain, either for users or aliases. @@ -98,6 +99,12 @@ dbpath=$db_path query = SELECT destination FROM aliases WHERE source='%s' EOF +# SQL statement to implicitly define an alias for each user so that existing users won't be caught by catchall aliases. +cat > /etc/postfix/virtual-self-alias-maps.cf << EOF; +dbpath=$db_path +query = SELECT email FROM users WHERE email='%s' +EOF + # Restart Services ##################