Инструменты пользователя

Инструменты сайта


postfix_i_mysql

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

postfix_i_mysql [2015/01/23 14:02]
postfix_i_mysql [2020/06/13 13:46] (текущий)
Строка 1: Строка 1:
 +====== Связка Postfix и MySQL ======
 +  * [[http://www.postfix.org/mysql_table.5.html|mysql_table - Postfix MySQL client configuration]]
 +  * [[postfix?&#maincf|main.cf]]
  
 +
 +  - Добавить в main.cf<file>
 +# ============================================================
 +# MySQL mappings
 +# ============================================================
 +relay_domains = proxy:mysql:/etc/postfix/mysql/relay_domains.cf
 +virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf,
 +                     proxy:mysql:/etc/postfix/mysql/virtual_alias_domain_maps.cf
 +virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
 +virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
 +</file>
 +  - **relay_domains**<file sql relay_domains.cf>
 +hosts = localhost
 +user = postfix
 +password = yourpassword
 +dbname = postfixadmin
 +
 +query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '1'
 +</file>Проверка:<file>
 +# postmap -q "example.com" mysql:/etc/postfix/mysql/relay_domains.cf
 +</file>
 +  - **virtual_alias_maps**<file sql virtual_alias_maps.cf>
 +hosts = localhost
 +user = postfix
 +password = yourpassword
 +dbname = postfixadmin
 +
 +query = SELECT goto FROM alias WHERE address='%s' AND active = '1'
 +</file>Проверка:<file>
 +# postmap -q "abuse@example.com" mysql:/etc/postfix/mysql/virtual_alias_maps.cf
 +</file><file sql virtual_alias_domain_maps.cf>
 +hosts = localhost
 +user = postfix
 +password = yourpassword
 +dbname = postfixadmin
 +
 +</file>
 +  - **virtual_mailbox_domains**<file sql virtual_mailbox_domains.cf>
 +hosts = localhost
 +user = postfix
 +password = yourpassword
 +dbname = postfixadmin
 +
 +query = SELECT domain FROM domain WHERE domain='%s' AND backupmx = '0' AND active = '1'
 +</file>Проверка:<file>
 +# postmap -q "example.com" mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
 +</file>
 +  - **virtual_mailbox_maps**<file sql virtual_mailbox_maps.cf>
 +hosts = localhost
 +user = postfix
 +password = yourpassword
 +dbname = postfixadmin
 +
 +query = SELECT CONCAT(domain,'/',maildir) AS maildir FROM mailbox WHERE username='%s' AND active = '1'
 +</file>Проверка:<file>
 +# postmap -q "noreply@example.com" mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
 +</file>