Skip to content
Snippets Groups Projects
Commit 3b8f5758 authored by Jesse Norell's avatar Jesse Norell
Browse files

migrate legacy postfix mysql query interface to "new" interface

parent 09d8e8ab
No related branches found
No related tags found
1 merge request!1009email account forward
Showing
with 43 additions and 70 deletions
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_access
select_field = access
where_field = source
additional_conditions = and type = 'client' and active = 'y'
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select access from mail_access where source = '%s' and type = 'client' and active = 'y'
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_domain
select_field = domain
where_field = domain
additional_conditions = and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select domain from mail_domain where domain = '%s' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = email
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select email from mail_user where email = '%s' and postfix = 'y' and disabledeliver = 'n' and server_id = {server_id}
union
select cc as email from mail_user where email = '%s' and postfix = 'y' and disabledeliver = 'y' and server_id = {server_id}
......@@ -2,4 +2,20 @@ user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
hosts = {mysql_server_ip}
query = SELECT u.email as target FROM mail_forwarding as s INNER JOIN mail_user as u ON (u.email = CONCAT('%u@', SUBSTRING_INDEX(s.destination,'@',-1))) WHERE s.source = '@%d' AND s.type = 'aliasdomain' AND s.active = 'y' AND u.disabledeliver = 'n' AND s.server_id = {server_id} UNION SELECT s.destination as target FROM mail_forwarding as s WHERE s.source = '%s' AND s.type IN ('alias', 'forward') and s.active = 'y' AND s.server_id = {server_id} UNION SELECT s.destination as target FROM mail_forwarding as s INNER JOIN mail_forwarding as f ON (f.source = CONCAT('%u@', SUBSTRING_INDEX(s.destination,'@',-1))) WHERE s.source = '@%d' AND s.type = 'aliasdomain' AND s.active = 'y' AND f.active = 'y' AND s.server_id = {server_id} UNION SELECT s.destination as target FROM mail_forwarding as s WHERE s.source = '@%d' AND s.type IN ('catchall') and s.active = 'y' AND s.server_id = {server_id} UNION SELECT s.destination as target FROM mail_forwarding as s INNER JOIN mail_forwarding as t ON (t.source = s.destination AND t.type = 'catchall') WHERE s.source = '@%d' AND s.type = 'aliasdomain' and s.active = 'y' AND t.active = 'y' AND s.server_id = {server_id}
query = SELECT u.email as target FROM mail_forwarding as s
INNER JOIN mail_user as u ON (u.email = CONCAT('%u@', SUBSTRING_INDEX(s.destination,'@',-1)))
WHERE s.source = '@%d' AND s.type = 'aliasdomain' AND s.active = 'y' AND u.disabledeliver = 'n' AND s.server_id = {server_id}
UNION
SELECT s.destination as target FROM mail_forwarding as s
WHERE s.source = '%s' AND s.type IN ('alias', 'forward') and s.active = 'y' AND s.server_id = {server_id}
UNION
SELECT s.destination as target FROM mail_forwarding as s
INNER JOIN mail_forwarding as f ON (f.source = CONCAT('%u@', SUBSTRING_INDEX(s.destination,'@',-1)))
WHERE s.source = '@%d' AND s.type = 'aliasdomain' AND s.active = 'y' AND f.active = 'y' AND s.server_id = {server_id}
UNION
SELECT s.destination as target FROM mail_forwarding as s
WHERE s.source = '@%d' AND s.type IN ('catchall') and s.active = 'y' AND s.server_id = {server_id}
UNION
SELECT s.destination as target FROM mail_forwarding as s
INNER JOIN mail_forwarding as t ON (t.source = s.destination AND t.type = 'catchall')
WHERE s.source = '@%d' AND s.type = 'aliasdomain' and s.active = 'y' AND t.active = 'y' AND s.server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = gid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select gid from mail_user where email = '%s' and postfix = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
where_field = login
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
query = select CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') from mail_user where login = '%s' and postfix = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = sender_cc
where_field = email
additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disables$
hosts = {mysql_server_ip}
\ No newline at end of file
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = sender_cc
where_field = email
additional_conditions = and postfix = 'y' and disabledeliver = 'n' and disablesmtp = 'n' and sender_cc != ''
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select sender_cc from mail_user where email = '%s' and postfix = 'y' and disabledeliver = 'n' and disablesmtp = 'n' and sender_cc != ''
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
hosts = {mysql_server_ip}
query = SELECT 'greylisting' FROM
(SELECT `greylisting`, 1 as `prio` FROM `mail_user` WHERE `server_id` = {server_id} AND `email` = '%s'
UNION SELECT `greylisting`, 2 as `prio` FROM `mail_forwarding` WHERE `server_id` = {server_id} AND `source` = '%s'
UNION SELECT `greylisting`, 3 as `prio` FROM `mail_forwarding` WHERE `server_id` = {server_id} AND `source` = '@%d' ORDER BY `prio` ASC LIMIT 1) as rules
WHERE rules.greylisting = 'y'
hosts = {mysql_server_ip}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_access
select_field = access
where_field = source
additional_conditions = and type = 'recipient' and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select access from mail_access where source = '%s' and type = 'recipient' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_transport
select_field = domain
where_field = domain
additional_conditions = and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select domain from mail_transport where domain = '%s' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_relay_recipient
select_field = access
where_field = source
additional_conditions = and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select access from mail_relay_recipient where source = '%s' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_access
select_field = access
where_field = source
additional_conditions = and type = 'sender' and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select access from mail_access where source = '%s' and type = 'sender' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
hosts = {mysql_server_ip}
query = SELECT destination FROM mail_forwarding WHERE source = '%s' AND active = 'y' AND allow_send_as = 'y' AND server_id = {server_id} UNION SELECT email FROM mail_user WHERE email = '%s' AND disablesmtp = 'n' AND server_id = {server_id};
hosts = {mysql_server_ip}
\ No newline at end of file
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_transport
select_field = transport
where_field = domain
additional_conditions = and active = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
hosts = {mysql_server_ip}
query = select transport from mail_transport where domain = '%s' and active = 'y' and server_id = {server_id}
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = uid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
query = select uid from mail_user where email = '%s' and postfix = 'y' and server_id = {server_id}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment