Per wrote regarding 'Re: [SLE] Relaying.' on Mon, Jan 24 at 04:36:
Carlos E. R. wrote:
How on earth do I tell postfix to use diferent relays based on destination address, from addres, and posibly, ISP used to connect each time?
Based on destination: /etc/postfix/main.cf[transport_maps], /etc/postfix/transport
Based on from addr - not sure. Perhaps with header_checks.
You use /etc/postfix/transports for choosing a transport based on destination address, and can specify said destination address either as a full address (user@do.main) or just a domain (do.main or .do.main). You can only select a transport based on the recipient address, though, not the sender address. AFAIK.
Based on which ISP - I think you can use something like this:
relayhost = [smtp.isp1.com], [smtp.isp2.com]
The relayhost parameter is used when the recipient doesn't match anything in the transports table(s). If you specify the hosts for two ISPs, the only time it'll go to the second is when the first is unreachable. Normally, the first will either accept the message, or reject with a specified code - which postfix will respect (rather than moving on to the next possible host). If you want to send to a different relay based on what ISP you're connected through, you'll have to set up a script that changes the default transport (or the whole transport map) each time you connect. What *I* would do in that situation, presuming Carlos wants to be just like me, is to make a transport map for each ISP I connect though, and another transport map that has things that are common to both ISPs. So, I've now got transport, transport_ISP1, and transport_ISP2 in /etc/postfix. Then, in my post-connect script for ISP1, I'd run postconf -e "transport_maps=hash:/etc/postfix/transport,\ hash:/etc/postfix/transport_ISP1" postfix reload and similarly for ISP2. That way, my global transport settings are preserved for both ISPs (/etc/postfix/transport), and the map for per-ISP settings are added depending on who I'm connected through. Make sure the global one is listed first, and check out the man page for "transport". --Danny, who likes postfix