diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index 8ffb76f6a..ec139fc53 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -182,16 +182,6 @@ dbname = ${DBNAME} query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts WHERE id IN ( SELECT COALESCE( - (SELECT id FROM relayhosts - LEFT OUTER JOIN domain ON domain.relayhost = relayhosts.id - WHERE relayhosts.active = '1' - AND (domain.domain = '%d' - OR domain.domain IN ( - SELECT target_domain FROM alias_domain - WHERE alias_domain = '%d' - ) - ) - ), (SELECT id FROM relayhosts LEFT OUTER JOIN mailbox ON JSON_UNQUOTE(JSON_VALUE(mailbox.attributes, '$.relayhost')) = relayhosts.id WHERE relayhosts.active = '1' @@ -204,6 +194,16 @@ query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts AND alias.address NOT LIKE '@%%' ) ) + ), + (SELECT id FROM relayhosts + LEFT OUTER JOIN domain ON domain.relayhost = relayhosts.id + WHERE relayhosts.active = '1' + AND (domain.domain = '%d' + OR domain.domain IN ( + SELECT target_domain FROM alias_domain + WHERE alias_domain = '%d' + ) + ) ) ) )