dnl dnl доставка сообщений по mailertable dnl NO - не использовать отсылку по mailertable dnl TEXT - использовать отсылку по mailertable в виде текстового файла dnl DBM - использовать отсылку по mailertable в виде DBM файла dnl MYSQL - использовать отсылку по mailertable в виде таблицы в базе данных MYSQL dnl define(`confMAILERTABLE', `NO')dnl dnl define(`confMAILERTABLE_MYSQL', `SELECT transport, route FROM mailertable WHERE domain="${quote_mysql:$domain}"')dnl dnl dnl маршруты почты прописываются в CONFDIR/mailertable в виде: dnl domain : smtp : host1 : host2 : host3 dnl domain : local : local_mailbox dnl domain : virt : mailbox@virtual_domain dnl dnl где local - доставка почты домена в локальный mailbox dnl virt - доставка почты домена в mailbox в виртуальном домене dnl smtp - доставка почты домена по smtp по маршруту dnl при этом можно вместо имени хоста применить конструкцию mx(domain) dnl при этом в начале configure должен быть подключен файл exim.pl с функцией sortmx: dnl dnl sub sortmx() { dnl if(not defined(@_)) { dnl return(undef); dnl } else { dnl my($mxs) = shift; dnl my(%mx_list, $mx, $prec, $line); dnl foreach $mx (split(/\n/m, $mxs)) { dnl ($prec, $line) = split(/\s+/, $mx); dnl $prec += 20000; dnl $mx_list{$prec} = $line; dnl } dnl if (%mx_list) { dnl my($res); dnl foreach (sort(keys(%mx_list))) { dnl $res .= ':' if ($res); dnl $res .= $mx_list{$_}; dnl } dnl return($res); dnl } else { dnl return('not found'); dnl } dnl } dnl } dnl ifdef(`confPERL',`',` errprint(`*** ERROR: confPERL variable required ')') ifelse(SECTION, `ACL_CHECK_RCPT', `dnl # Проверка существования получателей из shared pop доменов ifelse(confMAILERTABLE, `TEXT', `dnl deny set acl_m0 = ${if match{${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {Address $1, expanded from $local_part$domain, is unrouteable}\ {skip}} ') ifelse(confMAILERTABLE, `DBM', `dnl deny set acl_m0 = ${if match{${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {Address $1, expanded from $local_part$domain, is unrouteable}\ {skip}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl deny set acl_m0 = ${if match\ {${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*virt\s*$\N}\ {Address $1, expanded from $local_part$domain, is unrouteable}\ {skip}} ') condition = ${if eq{$acl_m0}{skip}{no}{yes}} message = $acl_m0 log_message = $acl_m0 ! verify = recipient ')dnl dnl ifelse(SECTION, `ACL_CHECK_RCPT_BOTTOM', `dnl # Прием почты для получателей из shared pop доменов ifelse(confMAILERTABLE, `TEXT', `dnl accept condition = ${if match{${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {yes}{no}} ') ifelse(confMAILERTABLE, `DBM', `dnl accept condition = ${if match{${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {yes}{no}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl accept condition = ${if match\ {${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*virt\s*$\N}\ {yes}{no}} ') endpass ') ifelse(SECTION, `ROUTERS', `dnl ifelse_strstr(confDELIVERY_TO, `MDIR_VIRTUAL', `dnl # доставка почты домена в single maildir route_sharedpop_to_virtmaildir: driver = redirect ifelse(confMAILERTABLE, `TEXT', `dnl condition = ${if match{${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {yes}{no}} data = ${if match{${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} ') ifelse(confMAILERTABLE, `DBM', `dnl condition = ${if match{${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {yes}{no}} data = ${if match{${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*virt\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl condition = ${if match{${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*virt\s*$\N}\ {yes}{no}} data = ${extract{route}{${lookup mysql{confMAILERTABLE_MYSQL}}}} ') # no_verify ') ifelse_strstr(confDELIVERY_TO, `MBOX', `dnl # обработка .forward при доставке почты домена в mailbox forward_sharedpop: driver = redirect ifelse(confMAILERTABLE, `TEXT', `dnl condition = ${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {${if exists{/home/$1/.forward}{yes}{no}}}{no}} user = ${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} file = /home/${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}}\ /.forward ') ifelse(confMAILERTABLE, `DBM', `dnl condition = ${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {${if exists{/home/$1/.forward}{yes}{no}}}{no}} user = ${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} file = /home/${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}}\ /.forward ') ifelse(confMAILERTABLE, `MYSQL', `dnl condition = ${if match\ {${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*local\s*$\N}\ {yes}{no}} user = ${extract{route}{${lookup mysql{confMAILERTABLE_MYSQL}}}} require_files = /home/\ ${extract{route}{${lookup mysql{confMAILERTABLE_MYSQL}}}}\ /.forward file = /home/\ ${extract{route}{${lookup mysql{confMAILERTABLE_MYSQL}}}}\ /.forward ') # no_verify no_expn check_ancestor file_transport = address_file pipe_transport = address_pipe reply_transport = address_reply ifelse_strstr(confDELIVERY_TO, `FILTERS', `dnl allow_filter ') # доставка почты домена в mailbox route_sharedpop_to_mailbox: driver = accept transport = delivery_to_sharedpop_mailbox ifelse(confMAILERTABLE, `TEXT', `dnl condition = ${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*\S+$\N}\ {yes}{no}} ') ifelse(confMAILERTABLE, `DBM', `dnl condition = ${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*\S+$\N}\ {yes}{no}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl condition = ${if match\ {${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*local\s*$\N}\ {yes}{no}} ') # no_verify ') dnl # роутинг почты доменов route_by_smtp: driver = manualroute domains = ! +local_domains transport = remote_smtp ifelse(confMAILERTABLE, `TEXT', `dnl condition = ${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*smtp\s*:\s*(\S.+)$\N}\ {yes}{no}} route_data = ${sg{\ ${if match\ {${sg\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N(?i)mx\(([^:]+?)\)\N}\ {\N${perl{sortmx}{${lookup dnsdb{mx=$1}}}}\N}\ }}\ {\N^(?i)\s*smtp\s*:\s*(\S.+)$\N}\ {$1}{}}\ }{\N\s\N}{}} ') ifelse(confMAILERTABLE, `DBM', `dnl condition = ${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*smtp\s*:\s*(\S.+)$\N}\ {yes}{no}} route_data = ${sg{\ ${if match\ {${sg\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N(?i)mx\(([^:]+?)\)\N}\ {\N${perl{sortmx}{${lookup dnsdb{mx=$1}}}}\N}\ }}\ {\N^(?i)\s*smtp\s*:\s*(\S.+)$\N}\ {$1}{}}\ }{\N\s\N}{}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl condition = ${if match\ {${extract{transport}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N^(?i)\s*smtp\s*$\N}\ {yes}{no}} route_data = ${sg{\ ${if match\ {${sg{${extract{route}{${lookup mysql{confMAILERTABLE_MYSQL}}}}}\ {\N(?i)mx\(([^:]+?)\)\N}\ {\N${perl{sortmx}{${lookup dnsdb{mx=$1}}}}\N}\ }}\ {\N^(?i)\s*smtp\s*:\s*(\S.+)$\N}\ {$1}{}}\ }{\N\s\N}{}} ') no_verify ') dnl ifelse(SECTION, `TRANSPORTS', `dnl ifelse_strstr(confDELIVERY_TO, `MBOX', `dnl # доставка почты домена в mailbox delivery_to_sharedpop_mailbox: driver = appendfile delivery_date_add envelope_to_add return_path_add group = mail ifelse(confMAILERTABLE, `TEXT', `dnl user = ${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} file = /var/mail/${if match\ {${lookup{$domain}lsearch{CONFDIR/mailertable}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} ') ifelse(confMAILERTABLE, `DBM', `dnl user = ${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} file = /var/mail/${if match\ {${lookup{$domain}dbm{CONFDIR/mailertable.db}}}\ {\N^(?i)\s*local\s*:\s*(\S+)\s*(:.*)?$\N}\ {$1}{}} ') ifelse(confMAILERTABLE, `MYSQL', `dnl condition = ${if match\ {${extract{transport}\ {${lookup mysql{confMAILERTABLE_MYSQL}}}\ }}\ {\N^(?i)\s*local\s*$\N}\ {yes}{no}} user = ${extract{route}\ {${lookup mysql{confMAILERTABLE_MYSQL}}}\ } file = /var/mail/${extract{route}\ {${lookup mysql{confMAILERTABLE_MYSQL}}}\ } ') mode = 0660 no_mode_fail_narrower ') ')