Commits

Zhang Huangbin committed 44fbfba

Merge per-domain and per-user transport_maps MySQL lookup into one file:
- Removed: mysql/transport_maps_domain.cf, mysql/transport_maps_user.cf
- New: mysql/transport_maps.cf

Comments (0)

Files changed (6)

iRedMail/ChangeLog

 iRedMail-0.8.6:
+    * Merge per-domain and per-user transport_maps MySQL lookup into one file:
+      - Removed: mysql/transport_maps_domain.cf, mysql/transport_maps_user.cf
+      - New: mysql/transport_maps.cf
     * Better support for installing iRedMail with remote MySQL server.
       Reference:
       http://www.iredmail.org/wiki/index.php?title=IRedMail/FAQ/MySQL/install.iredmail.with.remote.mysql.server

iRedMail/conf/postfix

 
 # MySQL lookup.
 export mysql_virtual_mailbox_domains_cf="${POSTFIX_LOOKUP_DIR}/virtual_mailbox_domains.cf"
-export mysql_transport_maps_user_cf="${POSTFIX_LOOKUP_DIR}/transport_maps_user.cf"
-export mysql_transport_maps_domain_cf="${POSTFIX_LOOKUP_DIR}/transport_maps_domain.cf"
+export mysql_transport_maps_cf="${POSTFIX_LOOKUP_DIR}/transport_maps.cf"
 export mysql_virtual_mailbox_maps_cf="${POSTFIX_LOOKUP_DIR}/virtual_mailbox_maps.cf"
 export mysql_virtual_alias_maps_cf="${POSTFIX_LOOKUP_DIR}/virtual_alias_maps.cf"
 export mysql_catchall_maps_cf="${POSTFIX_LOOKUP_DIR}/catchall_maps.cf"

iRedMail/functions/postfix.sh

 {
     ECHO_DEBUG "Configure Postfix for MySQL lookup."
 
-    postconf -e transport_maps="proxy:mysql:${mysql_transport_maps_user_cf}, proxy:mysql:${mysql_transport_maps_domain_cf}"
+    postconf -e transport_maps="proxy:mysql:${mysql_transport_maps_cf}"
     postconf -e virtual_mailbox_domains="proxy:mysql:${mysql_virtual_mailbox_domains_cf}"
     postconf -e virtual_mailbox_maps="proxy:mysql:${mysql_virtual_mailbox_maps_cf}"
     postconf -e virtual_alias_maps="proxy:mysql:${mysql_virtual_alias_maps_cf}, proxy:mysql:${mysql_domain_alias_maps_cf}, proxy:mysql:${mysql_catchall_maps_cf}, proxy:mysql:${mysql_domain_alias_catchall_maps_cf}"
     postconf -e relay_domains="\$mydestination, proxy:mysql:${mysql_relay_domains_cf}"
     postconf -e smtpd_sender_login_maps="proxy:mysql:${mysql_sender_login_maps_cf}"
 
-    # Per-domain and per-user transport maps.
-    cp ${SAMPLE_DIR}/postfix/mysql/transport_maps_domain.cf ${mysql_transport_maps_domain_cf}
-    cp ${SAMPLE_DIR}/postfix/mysql/transport_maps_user.cf ${mysql_transport_maps_user_cf}
+    cp ${SAMPLE_DIR}/postfix/mysql/transport_maps.cf ${mysql_transport_maps_cf}
     # Virtual domains
     cp ${SAMPLE_DIR}/postfix/mysql/virtual_mailbox_domains.cf ${mysql_virtual_mailbox_domains_cf}
     # Relay domains
 EOF
 
     for i in \
-        ${mysql_transport_maps_domain_cf} \
-        ${mysql_transport_maps_user_cf} \
+        ${mysql_transport_maps_cf} \
         ${mysql_virtual_mailbox_domains_cf} \
         ${mysql_relay_domains_cf} \
         ${mysql_virtual_mailbox_maps_cf} \

iRedMail/samples/postfix/mysql/transport_maps.cf

+user        = vmail
+password    = NSep2RRC7vzN9k6dW5bnc07fTLDEW7
+hosts       = 127.0.0.1
+port        = 3306
+dbname      = vmail
+query       = SELECT IF(mailbox.transport<>'', mailbox.transport, domain.transport) AS transport FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.domain='%d' AND mailbox.domain=domain.domain AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.backupmx=0 AND domain.active=1

iRedMail/samples/postfix/mysql/transport_maps_domain.cf

-user        = vmail
-password    = NSep2RRC7vzN9k6dW5bnc07fTLDEW7
-hosts       = 127.0.0.1
-port        = 3306
-dbname      = vmail
-query       = SELECT transport FROM domain WHERE domain='%s' AND active=1

iRedMail/samples/postfix/mysql/transport_maps_user.cf

-user        = vmail
-password    = NSep2RRC7vzN9k6dW5bnc07fTLDEW7
-hosts       = 127.0.0.1
-port        = 3306
-dbname      = vmail
-query       = SELECT mailbox.transport FROM mailbox,domain WHERE mailbox.username='%s' AND mailbox.domain='%d' AND mailbox.domain=domain.domain AND mailbox.transport<>'' AND mailbox.active=1 AND mailbox.enabledeliver=1 AND domain.backupmx=0 AND domain.active=1