Topic: Add on: Modify PostfixAdmin to relay mail to a smarthost
I use iRedMail also for filtering and relaying to another mailserver. Below the instructions to add this feature to PostfixAdmin for easy managing this feature.
Always make a backup of any change you make!
Step 1: Prepare the database:
Add the code below with PhpMyAdmin:
ALTER TABLE `domain` ADD `destination` VARCHAR( 150 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL AFTER `transport` ;
Step 2: Edit /etc/postfix/main.cf and add this at the bottom:
transport_maps = mysql:/etc/postfix/mysql/mysql_virtual_transport_maps.cf relay_domains = $transport_maps
Step 3: Create a new file called: /etc/postfix/mysql_virtual_transport_maps.cf and paste the code below in this file:
# mysql_virtual_transport_maps.cf user = vmail password = your iRedmail-password (can be found in another file in this directory) hosts = 127.0.0.1 port = 3306 dbname = vmail query = SELECT destination FROM domain WHERE domain='%d' AND transport='relay' AND active='1'
Step 4: Replace all the file in the attached ZIP to your postfixadmin directory.
Keep in mind that the locale-changes are only attached for the English language!!! Search in this file for "smart" (there should be two occurrences) and copy this line to your own locale-file in the languages directory.