1 (edited by quentin 2009-06-16 22:36:19)

Topic: Add on: Modify PostfixAdmin to relay mail to a smarthost

Hi,

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.

Good luck!

Quentin

2

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

It seems great. Thanks for your sharing smile

3

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

I am looking to try out this add-on but it does not seem to work. I am not seeing a way to set the destination for the relay in the add or edit domain interfaces. Did the zip file contain all the needed changes? I noticed that the files in the template/ directory of the zip are not any different than the stock postfixadmin files of the same name. Did you mean to include templates/admin_edit-domain.php and templates/admin_create-domain.php instead? I'd love to get this working as this is exactly what I need. Thanks in advance for your help!

4

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

Have to concur with the above poster. I cannot see where to specify a relay host either. I too am looking to accept mail, filter it and send it on to an internal Exchange server. Can someone please contribute how this is done?

Thanks guys. smile

5

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

So far, I've just been adding the domains with PostfixAdmin and then using phpMyAdmin to add the transport settings. Not ideal, but it works. Also, when doing this, you need to create a domain to domain catch-all alias or postfix won't relay for that domain. I just set the alias in PostfixAdmin as a catchall back to the same domain for each domain I need to relay for, works great. ie; *@domain.tld -> @domain.tld

6

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

I did the steps mentioned above. Still i dont see any option in postfix admin to add relay or route. Please help

7 (edited by quentin 2009-08-19 20:21:00)

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

Well, when you have overwritten the files that are attached to my first message you should see a new field when you add a domain called: "smarthost". Here you have to fill in the address or hostname where iRedMail should deliver the mail to.
You have to set the transport to relay.

8

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

Wheres the attached zip file?

9

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

There is more to it then just relaying. This feature should be setup considering all things that might come with it.

There is a great howto that covers most if not all aspects of being relay, at http://www200.pair.com/mecham/spam/virt … tml#relay.

10

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

quentin wrote:

Quentin

Helo Quentin, many thanks for your valuable contribution relaying  domains to another host. As a pity I cpuld not find the mentioned zip file. Could you sent me that zip file?
Many thanks in advande
TJ

11

Re: Add on: Modify PostfixAdmin to relay mail to a smarthost

tjw wrote:

Helo Quentin, many thanks for your valuable contribution relaying  domains to another host. As a pity I cpuld not find the mentioned zip file. Could you sent me that zip file?
Many thanks in advande
TJ

i too have come across this howto as this is exactly what i need, but am unable to find the "attached" zipfile. could it please be reattached or somehow linked to from here please?