diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index e734a9ab..78b070e0 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -323,7 +323,19 @@ hosts = unix:/var/run/mysqld/mysqld.sock dbname = ${DBNAME} # First select queries domain and alias_domain to determine if domains are active. query = SELECT goto FROM alias - WHERE address='%s' + WHERE id IN ( + SELECT COALESCE ( + ( + SELECT id FROM alias + WHERE address='%s' + AND (active='1' OR active='2') + ), ( + SELECT id FROM alias + WHERE address='@%d' + AND (active='1' OR active='2') + ) + ) + ) AND active='1' AND (domain IN (SELECT domain FROM domain @@ -354,7 +366,7 @@ query = SELECT goto FROM alias WHERE alias_domain.alias_domain = '%d' AND mailbox.username = CONCAT('%u','@',alias_domain.target_domain) AND (mailbox.active = '1' OR mailbox.active ='2') - AND alias_domain.active='1' + AND alias_domain.active='1'; EOF # MX based routing diff --git a/docker-compose.yml b/docker-compose.yml index bf914e73..cb9402da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -295,7 +295,7 @@ services: - dovecot postfix-mailcow: - image: mailcow/postfix:1.67 + image: mailcow/postfix:1.68 depends_on: - mysql-mailcow volumes: