Just try the following.. i think that should help. Enter this in the main.cf transport_maps = regexp:/etc/postfix/transport.regexp
transport.regexp should have the following content. if !/@locally.handled.domain.com$ / /^[a-f]/ smtp1: /^[g-j]/ smtp2: /^[l-q]/ smtp3: /^[r-w]/ smtp4: /^[x-z0-9]/ smtp5: endif Alternatively you can also use a transport randomizer script which is as below #!/usr/bin/perl my $port = 2525; my $max_servers = 100; my $spooldir = "/tmp"; my $user = "nobody"; my $group = "nogroup"; my $background = "1"; my $bindhost = "127.0.0.1"; package Grinch; use strict; use vars qw(@ISA); use Net::Server::PreForkSimple; use Sys::Syslog; my $version = "0.9"; my $syslog_ident = "grinch"; my $syslog_logopt = "pid"; my $syslog_facility = "mail"; @ISA = qw(Net::Server::PreForkSimple); my $pidfile = "$spooldir/pid.log"; sub grinchlog { syslog("info", shift); } sub process_request { my $mode; for (;($mode ne "once") && defined (my $cmd = <STDIN>); $mode = shift unless defined ($mode)) { my ($host) = $cmd =~ /^get ([a-z0-9\-\...@]+)/i; if ($host eq "*") { # we need to ignore the * query print "500 Blissfully ignoring asterisk!\n"; # grinchlog("ignoring *"); next; } if ($host =~ /((mail\.)?productionunit\.info|localhost)$/) { # we need to ignore queries involving our domains print "500 Blissfully ignoring our domains!\n"; grinchlog("ignoring our domains"); next; } my $random_number = int(rand(19)) + 1; # Returns a range of 1...5 print "200 smtp$random_number:\n"; grinchlog("$host -> smtp$random_number:"); next; } } my $mode = $ARGV[0]; openlog($syslog_ident, $syslog_logopt, $syslog_facility); if($mode eq "stop") { open (PID, "$pidfile"); my $pid = <PID>; close(PID); kill 15, $pid; unlink ($pidfile); } elsif ($mode eq "lookup") { process_request ("once"); } elsif (($mode eq "start") || ($mode eq "")) { # daemon mode, start it Grinch->run(port => $port, user => $user, group => $group, host => $bindhost, max_servers => $max_servers, background => $background, pid_file => $pidfile, log_file => "Sys::Syslog", syslog_ident => $syslog_ident, syslog_logopt => $syslog_logopt, syslog_facility => $syslog_facility); } else { print STDERR "unknown commandline option: $mode\n"; } closelog(); Which will run on a libnet server which will randomize the SMTP servers. Please note that you also need to mention the SMTP in the master.cf as follows smtp unix - - - - - smtp -o smtp_bind_address= to smtp1 unix - - - - - smtp -o smtp_bind_address= On Tue, Nov 10, 2009 at 21:12, Stan Hoeppner <s...@hardwarefreak.com> wrote: > Marc Silver put forth on 11/10/2009 2:23 AM: > > Hi, > > > > On Tue, 10 Nov 2009 09:03:56 +0200, Jack Knowlton <jknowl...@vp44.com> > > wrote: > >> Is it possible to have a transport map with a regular expression? What I > >> want is to use an external relay server for all the emails to be > >> delivered > >> on Yahoo domains (eg, yahoo.com, yahoo.co.uk, yahoo.es, ecc). > >> If it is possible, how can I implement this? > > > > I'm not an expert, but I believe this is possible by specifying your > > transport file as "transport_maps=regexp:/etc/postfix/transport". You > > may also use PCRE instead of regexp if you prefer. The only downside is > > that the entire file needs to be set up in the regex/pcre fashion (as > > far as I'm aware anyway). > > There is no downside, except the possible need for multiple transport > maps. He can have as many as he wants/needs, of all kinds, hash, pcre, > regexp, dbm, etc: > > > http://www.postfix.org/postconf.5.html > > transport_maps (default: empty) > > Optional lookup tables with mappings from recipient address to > (message delivery transport, next-hop destination). See transport(5) for > details. > > Specify zero or more "type:table" lookup tables. If you use this > feature with local files, run "postmap /etc/postfix/transport" after > making a change. > > For safety reasons, as of Postfix 2.3 this feature does not allow > $number substitutions in regular expression maps. > > Examples: > > transport_maps = dbm:/etc/postfix/transport > transport_maps = hash:/etc/postfix/transport > > > Instructions above tell us to use postmap on the file after any changes. > I think that assumes one is using hash, not any other maps types. > Check the use cases for postmap, as you dont use it on regexp or pcre > maps, but do use it on hash maps. I'm not sure WRT dbm maps as I've > never used them. > > -- > Stan >