Postfix / Scalix integration - redirect some mail in postfix

Best practice information from Scalix users relating to integration of Scalix with other products.

Moderator: ScalixSupport

freeloadermatt
Posts: 13
Joined: Fri Apr 23, 2010 4:34 am

Postfix / Scalix integration - redirect some mail in postfix

Postby freeloadermatt » Fri Apr 23, 2010 7:17 am

Hi,

I have set up a postfix server with spamassassing and ClamAV to filter inbound emails and redirect certain addresses within my domain to an external server like this:
1. All email for anyone@mydomain.com comes to postfix
2. Postfix and friends scan for spam and viruses
3. Postfix readdresses mail for someusers@mydomain.com to someuser@externaldomain.com and forwards everything to scalix
4. Scalix delivers local user emails to their mailboxes and sends the rest out to the external mailservers at other domains

The config I used to do this in postfix main.cf is:
virtual_alias_maps = hash:/etc/postfix/virtual <-- this contains the list that maps user@mydomain.com to realaddress@externaldomain.com
relay_domains = mydomain.com
relayhost = [scalix.mydomain.com]

I would like to reduce the load on the Scalix server by having postfix send the readdessed mails straight back out to the Internet rather than via Scalix. Right now they go to Scalix because postfix seems to base its relaying decision on the original address not the re-written one. Example from maillog file on the postfix server:
Apr 23 12:01:01 relay postfix/smtp[15873]: 7DABF2C74D: to=<user@externaldomain.com>, orig_to=<user@mydomain.com>, relay=scalix.mydomain.com[192.168.20.9]:25, delay=0.92, delays=0.08/0.03/0.01/0.8, dsn=2.0.0, status=sent (250 Ok)

Does anyone know the correct postfix config to achieve this and not have all the mails go via Scalix?

Thanks very much in advance for any help you can offer
Matt

pdtecag
Posts: 12
Joined: Mon Jul 07, 2008 4:12 am

Re: Postfix / Scalix integration - redirect some mail in postfix

Postby pdtecag » Tue Jul 06, 2010 8:51 am

The problem is that you use a relyhost directive which routes all mails that needs to be relayed to scalix
relayhost = [scalix.mydomain.com]


If you only want to route mail to scalix for which scalix is the destination you need to setup a transportmap instead of relaying everything,e.g.:

Code: Select all

transport_maps = hash:/etc/postfix/transport.scalix


transport.scalix:

Code: Select all

domain1.tld        smtp:[127.0.0.1]:10025
domain2.tld        smtp:[127.0.0.1]:10025
domain3.tld        smtp:[127.0.0.1]:10025


Now all domains scalix is responsible for ( domain1-3) will be routed to scalix and everything else is delivered directly to the destination MTA.

Regards

Marc

freeloadermatt
Posts: 13
Joined: Fri Apr 23, 2010 4:34 am

Re: Postfix / Scalix integration - redirect some mail in postfix

Postby freeloadermatt » Wed Jul 07, 2010 3:10 pm

Hi Marc,

Thank you very much for this. Would the transportmap be applied AFTER the virtualaliasmap? If so then this would achieve the effect that I want in that "user1@mydomain" can be readdressed to "user1@somewhereelse" while all other users for mydomain get sent to Scalix.

Thanks!
Matt


Return to “Third Party Integration”



Who is online

Users browsing this forum: No registered users and 1 guest

cron