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

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


postfix_i_mysql

Связка Postfix и MySQL

  1. Добавить в main.cf
    # ============================================================
    # 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
  2. relay_domains
    relay_domains.cf
    hosts = localhost
    USER = postfix
    password = yourpassword
    dbname = postfixadmin
     
    query = SELECT DOMAIN FROM DOMAIN WHERE DOMAIN='%s' AND backupmx = '1'

    Проверка:

    # postmap -q "example.com" mysql:/etc/postfix/mysql/relay_domains.cf
  3. virtual_alias_maps
    virtual_alias_maps.cf
    hosts = localhost
    USER = postfix
    password = yourpassword
    dbname = postfixadmin
     
    query = SELECT GOTO FROM alias WHERE address='%s' AND active = '1'

    Проверка:

    # postmap -q "abuse@example.com" mysql:/etc/postfix/mysql/virtual_alias_maps.cf
    virtual_alias_domain_maps.cf
    hosts = localhost
    USER = postfix
    password = yourpassword
    dbname = postfixadmin
  4. virtual_mailbox_domains
    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'

    Проверка:

    # postmap -q "example.com" mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
  5. virtual_mailbox_maps
    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'

    Проверка:

    # postmap -q "noreply@example.com" mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
postfix_i_mysql.txt · Последние изменения: 2015/01/23 11:02 (внешнее изменение)

Яндекс.Метрика