On 11/09/2013 02:33 PM, Simon Effenberg wrote:
On Sat, 09 Nov 2013 14:21:51 +0100
Jeroen Geilman <jer...@adaptr.nl> wrote:

On 11/9/2013 2:13 PM, Simon Effenberg wrote:
On Sat, 9 Nov 2013 07:54:30 -0500 (EST)
wie...@porcupine.org (Wietse Venema) wrote:

transport_maps can use hash tables AND tcp tables. transport_maps
queries each table in the specified order, and stops when a result
is found. When no result is found, Postfix uses default_transport.

        Wietse-

I got this but so it's impossible to do something like that:

main.cf:
    transport_maps = hash:/etc/postfix/transport, tcp:[127.0.0.1]:2527

transport:

    @domain1.tld smtp:[internal.relay]
    @domain2.tld smtp:[external.relay]

master.cf:
    127.0.0.1:2527 inet n n n - 0 spawn
      user=nobody argv=/etc/postfix/random.rb

random.rb:
    #!/usr/bin/env ruby

    TRANSPORTS = [ 'smtp1:', 'smtp2:', 'smtp3:' ]

    while line = STDIN.readline
      puts "200 #{TRANSPORTS[rand(TRANSPORTS.size)]}"
    end


If I'll try to send a mail to "x...@domain1.tld" this won't use
smtp:[internal.relay] but one of 'smtp1:', 'smpt2:' or 'smtp3:'

No. x...@domain1.tld matches the first line in /etc/postfix/transport.

You seem terminally confused about how maps are used.
Each map type has specific documentation on how it is queried, but no
map determines WHEN it is queried. You define that in transport_maps.
That's not how it works in my 2.9 postfix version.. trivial-rewrite is
doing the following (regarding to -vv logs):

1. search for x...@domain1.tld

   1. in transport which has NO match
   2. asking the tcp_table which HAS a match

This is incorrect.

As documented:

*TABLE SEARCH ORDER*
       With lookups from indexed files such as DB or DBM, or from
       networked tables such as NIS, LDAP or  SQL,  patterns  are
       tried in the order as listed below:

       /user+extension@domain transport/:/nexthop/
              Deliver   mail  for/user+extension@domain/   through
              /transport/  to/nexthop/.

       /user@domain transport/:/nexthop/
              Deliver mail for/user@domain/  through/transport/   to
              /nexthop/.

 *       **domain transport**:**nexthop*
              Deliver  mail  for/domain/  through/transport/  to/nex-/
              /thop/.

       /.domain transport/:/nexthop/
              Deliver mail for any subdomain  of/domain/   through
              /transport/   to/nexthop/.  This applies only when the
              string*transport_maps  
<http://www.postfix.org/postconf.5.html#transport_maps>*  is not  listed  in  the*par 
 <http://www.postfix.org/postconf.5.html#parent_domain_matches_subdomains>-*
              *ent_domain_matches_subdomains  
<http://www.postfix.org/postconf.5.html#parent_domain_matches_subdomains>*    
configuration  set-
              ting.  Otherwise, a domain name matches itself  and
              its subdomains.

       ***  /transport/:/nexthop/
              The  special pattern***  represents any address (i.e.
              it functions  as  the  wild-card  pattern,  and  is
              unique to Postfix transport tables).


@domain.tld will never match anything in transport(5).

Your transport map is incorrectly formed.

--
J.

Reply via email to