From 64ded60b5e8de1d929f6f46ec5d685b99f329a83 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 10 Sep 2017 15:30:25 +0200 Subject: [PATCH] Implement the postfix part of domain aliasing --- postfix/conf/sqlite-virtual_alias_maps.cf | 4 +++- postfix/conf/sqlite-virtual_mailbox_domains.cf | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/postfix/conf/sqlite-virtual_alias_maps.cf b/postfix/conf/sqlite-virtual_alias_maps.cf index a96fb034..f53b65ae 100644 --- a/postfix/conf/sqlite-virtual_alias_maps.cf +++ b/postfix/conf/sqlite-virtual_alias_maps.cf @@ -4,7 +4,9 @@ query = FROM (SELECT destination, email, wildcard, localpart FROM alias UNION - SELECT (CASE WHEN forward_enabled=1 THEN (CASE WHEN forward_keep=1 THEN email||',' ELSE '' END)||forward_destination ELSE email END) AS destination, email, 0 as wildcard, localpart FROM user) + SELECT (CASE WHEN forward_enabled=1 THEN (CASE WHEN forward_keep=1 THEN email||',' ELSE '' END)||forward_destination ELSE email END) AS destination, email, 0 as wildcard, localpart FROM user + UNION + SELECT '@'||domain_name as destination, '@'||name as email, 0 as wildcard, '' as localpart FROM alternative) WHERE ( wildcard = 0 diff --git a/postfix/conf/sqlite-virtual_mailbox_domains.cf b/postfix/conf/sqlite-virtual_mailbox_domains.cf index 2095ef2a..af453bce 100644 --- a/postfix/conf/sqlite-virtual_mailbox_domains.cf +++ b/postfix/conf/sqlite-virtual_mailbox_domains.cf @@ -1,2 +1,5 @@ dbpath = /data/main.db -query = SELECT name FROM domain WHERE name='%s' +query = + SELECT name FROM domain WHERE name='%s' + UNION + SELECT name FROM alternative WHERE name='%s'