Permalink
Browse files

Merge pull request #1631 from alexander255/patch-1

Allow users to send emails from alias domains
  • Loading branch information...
tonioo committed Jan 31, 2019
2 parents 511a9c3 + e676261 commit d1a5253e1ffb4b1ff3f8ce0688920cfe5fc330b4
Showing with 24 additions and 9 deletions.
  1. +24 −9 modoboa/admin/postfix_maps.py
@@ -116,10 +116,15 @@ class SenderLoginMap(object):
"WHERE sad.address='%s') "
"UNION "
"(SELECT concat(mb.address, '@', dom.name) FROM admin_mailbox mb "
"INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id"
" INNER JOIN admin_domain dom ON dom.id=mb.domain_id"
" INNER JOIN admin_alias al ON alr.alias_id=al.id "
"WHERE al.enabled=1 AND al.address='%s')"
"INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id "
"INNER JOIN admin_domain dom ON dom.id=mb.domain_id "
"INNER JOIN admin_alias al ON alr.alias_id=al.id "
"LEFT JOIN admin_domainalias adoma ON adoma.target_id=al.domain_id "
"LEFT JOIN admin_domain adom ON adom.id=adoma.target_id "
"WHERE al.enabled=1 AND ("
" al.address='%s' OR ("
" adoma.name='%d' AND al.address=concat('%u', '@', adom.name)"
")))"
)
postgres = (
"(SELECT email FROM core_user WHERE email='%s' AND is_active) "
@@ -130,10 +135,15 @@ class SenderLoginMap(object):
"WHERE sad.address='%s') "
"UNION "
"(SELECT mb.address || '@' || dom.name FROM admin_mailbox mb "
"INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id"
" INNER JOIN admin_domain dom ON dom.id=mb.domain_id"
" INNER JOIN admin_alias al ON alr.alias_id=al.id "
"WHERE al.enabled AND al.address='%s')"
"INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id "
"INNER JOIN admin_domain dom ON dom.id=mb.domain_id "
"INNER JOIN admin_alias al ON alr.alias_id=al.id "
"LEFT JOIN admin_domainalias adoma ON adoma.target_id=al.domain_id "
"LEFT JOIN admin_domain adom ON adom.id=adoma.target_id "
"WHERE al.enabled AND ("
" al.address='%s' OR ("
" adoma.name='%d' AND al.address='%u'||'@'||adom.name"
")))"
)
sqlite = (
"SELECT email FROM core_user WHERE email='%s' AND is_active=1 "
@@ -147,5 +157,10 @@ class SenderLoginMap(object):
"INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id "
"INNER JOIN admin_domain dom ON dom.id=mb.domain_id "
"INNER JOIN admin_alias al ON alr.alias_id=al.id "
"WHERE al.enabled=1 AND al.address='%s'"
"LEFT JOIN admin_domainalias adoma ON adoma.target_id=al.domain_id "
"LEFT JOIN admin_domain adom ON adom.id=adoma.target_id "
"WHERE al.enabled=1 AND ("
" al.address='%s' OR ("
" adoma.name='%d' AND al.address='%u'||'@'||adom.name"
"))"
)

0 comments on commit d1a5253

Please sign in to comment.