Code in this video_PostfixAdmin – Set Up A Mail Server with PostfixAdmin on Ubuntu | Debian – Part 2

PostfixAdmin – Set Up A Mail Server with PostfixAdmin on Ubuntu | Debian – Part 2 – Configure Postfix with MySQL/MariaDB

✳️ Some Important Information from Part 1
    🔸 Domain: totatca.xyz
    🔸 FQDN/Fullname: mail.totatca.xyz
    🔸 User and Group: totatca with ID 5000
    🔸 Email storage: /var/virtual_mail_box
    🔸 Database name: postfixadmin_db
    🔸 Database user: postfixadmin_user
    🔸 Database password: postfixadmin_PWDReplace the highlighted portion in orange with your information.If you make any changes, ensure to update the corresponding details in the following steps.

✳️ Code in this video:

	vim mysql_virtual_alias_domain_catchall_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'


	vim mysql_virtual_alias_domain_mailbox_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT maildir FROM mailbox,alias_domain WHERE alias_domain.alias_domain = '%d' and mailbox.username = CONCAT('%u', '@', alias_domain.target_domain) AND mailbox.active = 1 AND alias_domain.active='1'


	vim mysql_virtual_alias_domain_maps.cf
	
user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('%u', '@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'


	vim mysql_virtual_alias_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT goto FROM alias WHERE address='%s' AND active = '1'


	vim mysql_virtual_domains_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT domain FROM domain WHERE domain='%s' AND active = '1'


	vim mysql_virtual_mailbox_limit_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1'


	vim mysql_virtual_mailbox_maps.cf

user = postfixadmin_user
password = postfixadmin_PWD
hosts = localhost
dbname = postfixadmin_db
query = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'


### Configure Postfix to use MariaDB/MySQL Database

virtual_mailbox_domains = proxy:mysql:/etc/postfix/query/mysql_virtual_domains_maps.cf
virtual_alias_maps = 
	proxy:mysql:/etc/postfix/query/mysql_virtual_alias_maps.cf, 
	proxy:mysql:/etc/postfix/query/mysql_virtual_alias_domain_maps.cf, 
	proxy:mysql:/etc/postfix/query/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps = 
	proxy:mysql:/etc/postfix/query/mysql_virtual_mailbox_maps.cf, 
	proxy:mysql:/etc/postfix/query/mysql_virtual_alias_domain_mailbox_maps.cf

### Enable auth

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

virtual_transport = lmtp:unix:private/dovecot-lmtp

virtual_mailbox_base = /var/virtual_mail_box
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000


Thank You !!!

Leave a Reply

Your email address will not be published. Required fields are marked *