On Wed, Oct 01, 2008 at 01:38:36PM -0600, David DeFranco wrote: > Thanks for the answers. > > This is an internal mail server for system generated mail, and I'm > re-writing the address before determining the transport so there's sanity > checking already in place. I would never consider this kind of setup on a > user/internet relay server. Heck, I wouldn't consider this solution in the > first place, but it's legacy ( currently on sendmailx ) and I have to make > it work. I wanted to avoid using an explicit map file because it could be > complex and has to be updated manually. > > Is there another way to programmatically determine the next-hop?
Use (regexp) virtual alias mapping to rewrite recipients to suitably selected artificial domains that map statically to the right transport. In the transport, use smtp_generic_maps to undo the virtual mapping, so the destination sees an unmodified recipient address. virtual(5): [EMAIL PROTECTED] -> [EMAIL PROTECTED] [EMAIL PROTECTED] -> [EMAIL PROTECTED] transport(5): host1.nexthop.invalid mysmtp:[host1-gateway] host2.nexthop.invalid mysmtp:[host2-gateway] master.cf mysmtp ... smtp -o smtp_generic_maps=$mysmtp_generic_maps main.cf: mysmtp_generic_maps = pcre:/etc/postfix/undo_adhoc_routing.pcre virtual_alias_maps = pcre:/etc/postfix/do_adhoc_routing.pcre Beware of loops! Do not let the PCRE LHS pattern match the RHS output! -- Viktor. Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the "Reply-To" header. To unsubscribe from the postfix-users list, visit http://www.postfix.org/lists.html or click the link below: <mailto:[EMAIL PROTECTED]> If my response solves your problem, the best way to thank me is to not send an "it worked, thanks" follow-up. If you must respond, please put "It worked, thanks" in the "Subject" so I can delete these quickly.