FILTER nexthop woes

2010-01-11 Thread lkml
Hi,
I'm trying to use header_checks in conjunction with a pcre map to
distribute certain mail traffic to certain outgoing transports. I've got a
setup like this:

--- main.cf snip ---
header_checks = pcre:/etc/postfix/header.pcre
--- snap ---

--- header.pcre snip ---
/^X-CUSTOMER-ID: ([0-9])/ FILTER smtpout$1:
--- snap ---

In the master.cf I have smtpout0-9 transports like this one:
--- master.cf snip ---
smtpout0  unix  -   -   -   -   -   smtp
-o smtp_helo_name=server1.isp.net
-o smtp_bind_address=11.22.33.44
--- master.cf snap ---

With this setup I try to distribute my mail traffic according to the rules
defined in header.pcre. Unfortunately it does not work. According to
http://www.postfix.org/postconf.5.html#default_transport and
http://www.postfix.org/transport.5.html Postfix should use the recipient
domain as the nexthop, but it doesn't.

My Question: How can I filter my outgoing mail based on a header field to
an smtp-transport?

Best Regards,
Dominik


Re: FILTER nexthop woes

2010-01-11 Thread Wietse Venema
l...@ds.gauner.org:
> Hi,
> I'm trying to use header_checks in conjunction with a pcre map to
> distribute certain mail traffic to certain outgoing transports. I've got a
> setup like this:
> 
> --- main.cf snip ---
> header_checks = pcre:/etc/postfix/header.pcre
> --- snap ---
> 
> --- header.pcre snip ---
> /^X-CUSTOMER-ID: ([0-9])/ FILTER smtpout$1:

You MUST specify a nexthop destination.  The purpose of FILTER is
to send mail for MANY destinations through ONE filter destination.
If you don't specify a next-hop destination, then Postfix will
choose a default one.

To make Postfix routing sender dependent, use
sender_dependent_relayhost_maps (Postfix 2.3 and later) or
sender_dependent_default_transport_maps (Postfix 2.7 and later).

Wietse


Re: FILTER nexthop woes

2010-01-13 Thread Dominik Schulz
Am Montag 11 Januar 2010 15:08:05 schrieb Wietse Venema:
> l...@ds.gauner.org:
> > Hi,
> > I'm trying to use header_checks in conjunction with a pcre map to
> > distribute certain mail traffic to certain outgoing transports. I've got
> > a setup like this:
> > --- main.cf snip ---
> > header_checks = pcre:/etc/postfix/header.pcre
> > --- snap ---
> > --- header.pcre snip ---
> > /^X-CUSTOMER-ID: ([0-9])/ FILTER smtpout$1:
> You MUST specify a nexthop destination.  The purpose of FILTER is
> to send mail for MANY destinations through ONE filter destination.
> If you don't specify a next-hop destination, then Postfix will
> choose a default one.
> To make Postfix routing sender dependent, use
> sender_dependent_relayhost_maps (Postfix 2.3 and later) or
> sender_dependent_default_transport_maps (Postfix 2.7 and later).
Thanks for the reply. Unfortunately I don't seem to have myself clear.

I want to controll to nexthop (i.e. the outgoing relay) through some kind of 
"X-"-Header, e.g. "X-CUSTOMER_ID: 34554", and not through the sender/recipient 
addresses.

Is there some way to achieve this behaviour?

-- 
Mit freundlichen Grüßen / Best Regards
Dominik


signature.asc
Description: This is a digitally signed message part.


Re: FILTER nexthop woes

2010-01-13 Thread Wietse Venema
Dominik Schulz:
> Am Montag 11 Januar 2010 15:08:05 schrieb Wietse Venema:
> > l...@ds.gauner.org:
> > > Hi,
> > > I'm trying to use header_checks in conjunction with a pcre map to
> > > distribute certain mail traffic to certain outgoing transports. I've got
> > > a setup like this:
> > > --- main.cf snip ---
> > > header_checks = pcre:/etc/postfix/header.pcre
> > > --- snap ---
> > > --- header.pcre snip ---
> > > /^X-CUSTOMER-ID: ([0-9])/ FILTER smtpout$1:
> > You MUST specify a nexthop destination.  The purpose of FILTER is
> > to send mail for MANY destinations through ONE filter destination.
> > If you don't specify a next-hop destination, then Postfix will
> > choose a default one.
> > To make Postfix routing sender dependent, use
> > sender_dependent_relayhost_maps (Postfix 2.3 and later) or
> > sender_dependent_default_transport_maps (Postfix 2.7 and later).
> Thanks for the reply. Unfortunately I don't seem to have myself clear.
> 
> I want to controll to nexthop (i.e. the outgoing relay) through some kind of 
> "X-"-Header, e.g. "X-CUSTOMER_ID: 34554", and not through the 
> sender/recipient 
> addresses.
> 
> Is there some way to achieve this behaviour?

The short answer: specify a FILTER command that points to a Postfix
instance that has its own unique hostname, and that is bound to
its own unique IP address.

myhostname = unique-name.example.com
inet_interfaces = $myhostname

Adding Postfix instances is easy with Postfix 2.6.

Until someone explains why they must use the header and can't use
the envelope sender, I am not inclined to invest a lot of effort
on my side to find out if there exists a better solution.

Wietse