Query from example file docs/debian-conf.d/router/250_vexim_virtual_domains.
- If user added in any group, then he can send emails in any non-public group too - need
g.id = c.group_id:
virtual_dom_groups:
driver = redirect
domains = +local_domains
allow_fail
senders = ${if eq{Y}{${lookup mysql{select g.is_public \
from groups g, domains d \
where d.enabled = '1' and d.domain = '${quote_mysql:$domain}' and \
d.domain_id = g.domain_id and g.enabled = '1' and \
g.name = '${quote_mysql:$local_part}'}}} \
{$sender_address} \
{${lookup mysql{select concat_ws('@', u.localpart, d.domain) \
from domains d, groups g, group_contents c, users u \
where d.enabled = '1' and d.domain = '${quote_mysql:$domain}' and \
d.domain_id = g.domain_id and g.name = '${quote_mysql:$local_part}' and \
- g.enabled = '1' and \
+ g.enabled = '1' and g.id = c.group_id and \
g.is_public = 'N' and c.member_id = u.user_id and \
d.domain_id = u.domain_id and u.enabled = '1' \
and u.username = '${quote_mysql:$sender_address}' limit 1}}}}
- If alias was added in non-public group, then sender from main login can't send emails to this group.
This query fixed this:
virtual_dom_groups:
driver = redirect
domains = +local_domains
allow_fail
senders = ${if eq{Y}{${lookup mysql{select g.is_public \
from groups g, domains d \
where d.enabled = '1' and d.domain = '${quote_mysql:$domain}' and \
d.domain_id = g.domain_id and g.enabled = '1' and \
g.name = '${quote_mysql:$local_part}'}}} \
{$sender_address} \
{${lookup mysql{select concat_ws('@', u.localpart, d.domain) \
from domains d, groups g, group_contents c, users u \
where d.enabled = '1' and d.domain = '${quote_mysql:$domain}' and \
d.domain_id = g.domain_id and g.name = '${quote_mysql:$local_part}' and \
g.enabled = '1' and g.id = c.group_id and \
g.is_public = 'N' and c.member_id = u.user_id and \
d.domain_id = u.domain_id and u.enabled = '1' and \
u.username = '${quote_mysql:$sender_address}' \
union \
select concat_ws('@', a.localpart, d.domain) \
from domains d, groups g, group_contents c, users u, users a \
where d.enabled = '1' and d.domain = '${quote_mysql:$domain}' and \
d.domain_id = g.domain_id and g.name = '${quote_mysql:$local_part}' and \
g.enabled = '1' and g.id = c.group_id and \
g.is_public = 'N' and c.member_id = u.user_id and \
d.domain_id = u.domain_id and u.enabled = '1' and a.enabled = 1 and \
a.type = 'alias' and a.username = '${quote_mysql:$sender_address}' and \
a.smtp = u.username }}}}
Example: mailbox USER1@my.domain, alias ALIAS1@my.domain => USER1@my.domain, non-public group GROUP1@my.domain with member ALIAS1@my.domain.
With old sql query USER1@my.domain can't write in non-public group GROUP1@my.domain, only ALIAS1@my.domain can.
With new sql query USER1@my.domain can write in non-public group GROUP1@my.domain too.
Query from example file
docs/debian-conf.d/router/250_vexim_virtual_domains.g.id = c.group_id:This query fixed this:
Example: mailbox
USER1@my.domain, aliasALIAS1@my.domain=>USER1@my.domain, non-public groupGROUP1@my.domainwith memberALIAS1@my.domain.With old sql query
USER1@my.domaincan't write in non-public groupGROUP1@my.domain, onlyALIAS1@my.domaincan.With new sql query
USER1@my.domaincan write in non-public groupGROUP1@my.domaintoo.