Adding VMAIL users and MySQL files.

Let’s create VMail, which will be responsible for the delivery:
# useradd vmail -r -u 150 -g mail -d /var/vmail -s /sbin/nologin

Now we will create the directory in which VMail will store the data:
# mkdir /var/vmail
# chmod 770 /var/vmail/
# chown vmail:mail /var/vmail/

To create the MySQL configuration files that Postfix can “communicate” with it, follow these steps:
# cd /etc/postfix
# joe mysql_virtual_alias_maps.cf

user = mail
password = mail
hosts = localhost
dbname = mail
table = alias
select_field = goto
where_field = address
additional_conditions = and active = ‘1’
#query = SELECT goto FROM alias WHERE address=’%s’ AND active = ‘1’

# joe mysql_virtual_domains_maps.cf
user = mail
password = mail
hosts = localhost
dbname = mail
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = ‘0’ and active = ‘1’
#query = SELECT domain FROM domain WHERE domain=’%s’ AND backupmx = ‘0’ AND active = ‘1’

joe mysql_virtual_mailbox_limit_maps.cf
user = mail
password = mail
hosts = localhost
dbname = mail
table = mailbox
select_field = quota
where_field = username
additional_conditions = and active = ‘1’
#query = SELECT quota FROM mailbox WHERE username=’%s’ AND active = ‘1’

joe mysql_virtual_mailbox_maps.cf
user = mail
password = mail
hosts = localhost
dbname = mail
table = mailbox
select_field = CONCAT(domain,’/’,maildir)
where_field = username
additional_conditions = and active = ‘1’
#query = SELECT CONCAT(domain,’/’,maildir) FROM mailbox WHERE username=’%s’ AND active = ‘1’

Edit /etc/postfix/master.cf and add the following
## DOVECOT ##
dovecot unix – n n – – pipe
flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -d $(recipient)

Be the First to Comment!