●postfixadmin2
cat > /etc/postfix/mysql_virtual_alias_maps.cf << "EOF"
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address
EOF
cat > /etc/postfix/mysql_virtual_domains_maps.cf << "EOF"
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active = '1'
EOF
cat > /etc/postfix/mysql_virtual_mailbox_maps.cf << "EOF"
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
EOF
cat > /etc/postfix/mysql_virtual_mailbox_limit_maps.cf << "EOF"
user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1' << "EOF"
EOF
cat > /etc/dovecot-mysql.conf << "EOF"
driver = mysql
default_pass_scheme = PLAIN
connect = dbname=postfix user=postfix host=/var/lib/mysql/mysql.sock password=postfix
password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'
user_query = SELECT concat('/mail/', maildir) as home, 10000 as uid, 10000 as gid FROM mailbox WHERE username = '%u' AND active = '1'
EOF