diff --git a/.gitignore b/.gitignore index 3acc3bbff..d1843c61a 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ modoboa_test .coverage build/ dist/ +/.project +/.pydevproject diff --git a/modoboa/admin/postfix_maps.py b/modoboa/admin/postfix_maps.py index 026649070..d7c1eda64 100644 --- a/modoboa/admin/postfix_maps.py +++ b/modoboa/admin/postfix_maps.py @@ -119,7 +119,12 @@ class SenderLoginMap(object): "WHERE al.enabled=1 AND (" " al.address='%s' OR (" " adoma.name='%d' AND al.address=concat('%u', '@', adom.name)" - ")))" + "))) " + "UNION " + "(SELECT concat(mb.address, '@', dom.name) FROM admin_mailbox mb " + "INNER JOIN admin_senderaddress sad ON sad.mailbox_id=mb.id " + "INNER JOIN admin_domain dom ON dom.id=mb.domain_id " + "WHERE sad.address=concat('@','%d')) " ) postgres = ( "(SELECT email FROM core_user WHERE email='%s' AND is_active) " @@ -138,7 +143,12 @@ class SenderLoginMap(object): "WHERE al.enabled AND (" " al.address='%s' OR (" " adoma.name='%d' AND al.address='%u'||'@'||adom.name" - ")))" + "))) " + "UNION " + "(SELECT mb.address || '@' || dom.name FROM admin_mailbox mb " + "INNER JOIN admin_senderaddress sad ON sad.mailbox_id=mb.id " + "INNER JOIN admin_domain dom ON dom.id=mb.domain_id " + "WHERE sad.address='@'||'%d') " ) sqlite = ( "SELECT email FROM core_user WHERE email='%s' AND is_active=1 " @@ -157,5 +167,10 @@ class SenderLoginMap(object): "WHERE al.enabled=1 AND (" " al.address='%s' OR (" " adoma.name='%d' AND al.address='%u'||'@'||adom.name" - "))" + ")) " + "UNION " + "(SELECT mb.address || '@' || dom.name FROM admin_mailbox mb " + "INNER JOIN admin_senderaddress sad ON sad.mailbox_id=mb.id " + "INNER JOIN admin_domain dom ON dom.id=mb.domain_id " + "WHERE sad.address='@'||'%d') " )