Simon Effenberg: > > If you want to send domain1.tld and domain2.tld to the internal > > relay, then the correct syntax for a hash: map would be: > > > > domain1.tld smtp:[internal.relay] > > domain2.tld smtp:[external.relay] > > yes sorry.. was only wrong in my head while writing this example. In my > real transport file it is correct (without the @).
OK, so this sends mail for these two domains to the internal relay. All other destinations are passed to the TCP map. > > > 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 > > > > That randomly produces "smtp1:", "smtp2:", or "smtp3:" as response. > > I know. But replace it with whatever logic you want as a last resort if > no other transport_map maps a _complete mail_ or a _domain_. If you want the TCP map reply to depend on the result of ``line = STDIN.readline'', then you need to write code that produces that response. As documented in transport(5), The special query for "*" asks for a wild-card result. It does not matter for your configuration. Also in transport(5): TCP-BASED TABLES This section describes how the table lookups change when lookups are directed to a TCP-based server. For a description of the TCP client/server lookup protocol, see tcp_table(5). This feature is not available up to and including Postfix version 2.4. Each lookup operation uses the entire recipient address once. Thus, some.domain.hierarchy is not looked up via its parent domains, nor is user+foo@domain looked up as user@domain. Results are the same as with indexed file lookups. Wietse