Hi, i have this two tables
CREATE TABLE group_contents(
group_id int(10) DEFAULT '0' NOT NULL,
member varchar(255) DEFAULT '0' NOT NULL
admin char(1) NOT NULL default 'Y',
)
CREATE TABLE groups(
id INTEGER NOT NULL PRIMARY KEY,
domain_id mediumint (8) NOT NULL default '0',
name varchar(64) NOT NULL default '',
is_public char(1) NOT NULL default 'Y',
enabled tinyint(1) NOT NULL default '1'
);
groups.is_public allows Y,N,A
Y -> public
N -> not public
A -> only senders admin can send
I need add a rule for allow send emails to the group if sender is
group_contents.admin is Y and the group groups.is_public value is A,
Now I have this:
virtual_dom_groups:
driver = redirect
allow_fail
senders = ${if eq{Y}{${lookup sqlite{/etc/exim/exim.db select g.is_public\
from groups g, domains d \
where d.enabled = '1' and d.domain =
'${domain}' and \
d.domain_id = g.domain_id and
g.enabled = '1' and \
g.name = '${local_part}'}}} \
{$sender_address} \
{${lookup sqlite{/etc/exim/exim.db select c.member \
from group_contents c, groups g, domains d \
where g.enabled = '1' and g.id = c.group_id and g.is_public = 'N' \
and d.domain = '${domain}' \
and d.domain_id = g.domain_id and g.enabled = '1' \
and g.name = '${local_part}' \
and c.member LIKE '${sender_address}' limit 1}}}}
data = ${lookup sqlite{/etc/exim/exim.db \
select c.member \
from group_contents c, groups g, domains d \
where d.enabled = '1' and \
d.domain = '${domain}' and \
d.domain_id = g.domain_id and \
g.enabled = '1' and \
g.id = c.group_id and \
g.name = '${local_part}'} }
headers_remove = subject
headers_add = Subject: [${lookup sqlite{/etc/exim/exim.db select g.name \
from groups g, domains d \
where d.enabled = '1' and d.domain =
'${domain}' and \
d.domain_id = g.domain_id and
g.enabled = '1' and \
g.name = '${local_part}'}}]
$h_subject
local_part_suffix = -*
local_part_suffix_optional
retry_use_local_part
reply_transport = address_reply
pipe_transport = address_pipe